Changeset 15323
- Timestamp:
- 06/22/13 13:25:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp
r15314 r15323 56 56 * For node i, Bi can be expressed in the actual coordinate system 57 57 * by: 58 * Bi=[ d h/dx ]59 * [ d h/dy ]60 * where his the interpolation function for node i.58 * Bi=[ dN/dx ] 59 * [ dN/dy ] 60 * where N is the interpolation function for node i. 61 61 * 62 62 * We assume B has been allocated already, of size: 3x(NDOF2*NUMNODESP1) … … 66 66 int numnodes = this->NumberofNodes(); 67 67 68 /*Get nodal functions */68 /*Get nodal functions derivatives*/ 69 69 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 70 70 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss); … … 96 96 int numnodes = this->NumberofNodes(); 97 97 98 /*Get nodal functions */98 /*Get nodal functions derivatives*/ 99 99 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 100 100 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss); … … 120 120 * For node i, Bi can be expressed in the actual coordinate system 121 121 * by: 122 * Bi=[ dh/dx 0 ] 123 * [ 0 dh/dy ] 124 * [ 1/2*dh/dy 1/2*dh/dx ] 125 * where h is the interpolation function for node i. 126 * 127 * We assume B has been allocated already, of size: 3x(NDOF2*NUMNODESP1) 128 */ 129 130 /*Same thing in the actual coordinate system: */ 131 IssmDouble dbasis[NDOF2][NUMNODESP1]; 132 133 /*Get dh1dh2dh3 in actual coordinates system : */ 134 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss); 122 * Bi=[ dN/dx 0 ] 123 * [ 0 dN/dy ] 124 * [ 1/2*dN/dy 1/2*dN/dx ] 125 * where N is the interpolation function for node i. 126 * 127 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes) 128 */ 129 130 /*Fetch number of nodes for this finite element*/ 131 int numnodes = this->NumberofNodes(); 132 133 /*Get nodal functions derivatives*/ 134 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 135 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss); 135 136 136 137 /*Build B': */ 137 for (int i=0;i<NUMNODESP1;i++){ 138 B[NDOF2*NUMNODESP1*0+NDOF2*i+0]=dbasis[0][i]; 139 B[NDOF2*NUMNODESP1*0+NDOF2*i+1]=0.; 140 B[NDOF2*NUMNODESP1*1+NDOF2*i+0]=0.; 141 B[NDOF2*NUMNODESP1*1+NDOF2*i+1]=dbasis[1][i]; 142 B[NDOF2*NUMNODESP1*2+NDOF2*i+0]=0.5*dbasis[1][i]; 143 B[NDOF2*NUMNODESP1*2+NDOF2*i+1]=0.5*dbasis[0][i]; 144 } 138 for (int i=0;i<numnodes;i++){ 139 B[NDOF2*numnodes*0+NDOF2*i+0]=dbasis[0*numnodes+i]; 140 B[NDOF2*numnodes*0+NDOF2*i+1]=0.; 141 B[NDOF2*numnodes*1+NDOF2*i+0]=0.; 142 B[NDOF2*numnodes*1+NDOF2*i+1]=dbasis[1*numnodes+i]; 143 B[NDOF2*numnodes*2+NDOF2*i+0]=0.5*dbasis[1*numnodes+i]; 144 B[NDOF2*numnodes*2+NDOF2*i+1]=0.5*dbasis[0*numnodes+i]; 145 } 146 147 /*Clean-up*/ 148 xDelete<IssmDouble>(dbasis); 145 149 } 146 150 /*}}}*/ … … 154 158 */ 155 159 156 IssmDouble basis[NUMNODESP1]; 157 GetNodalFunctions(&basis[0],gauss); 158 160 /*Fetch number of nodes for this finite element*/ 161 int numnodes = this->NumberofNodes(); 162 163 /*Get nodal functions*/ 164 IssmDouble* basis=xNew<IssmDouble>(numnodes); 165 GetNodalFunctions(basis,gauss); 166 167 /*Build B for this segment*/ 159 168 B[0] = +basis[index1]; 160 169 B[1] = +basis[index2]; 161 170 B[2] = -basis[index1]; 162 171 B[3] = -basis[index2]; 172 173 /*Clean-up*/ 174 xDelete<IssmDouble>(basis); 163 175 } 164 176 /*}}}*/ … … 172 184 */ 173 185 174 IssmDouble basis[NUMNODESP1]; 175 GetNodalFunctions(&basis[0],gauss); 176 186 /*Fetch number of nodes for this finite element*/ 187 int numnodes = this->NumberofNodes(); 188 189 /*Get nodal functions*/ 190 IssmDouble* basis=xNew<IssmDouble>(numnodes); 191 GetNodalFunctions(basis,gauss); 192 193 /*Build B'*/ 177 194 Bprime[0] = basis[index1]; 178 195 Bprime[1] = basis[index2]; 179 196 Bprime[2] = basis[index1]; 180 197 Bprime[3] = basis[index2]; 198 199 /*Clean-up*/ 200 xDelete<IssmDouble>(basis); 181 201 } 182 202 /*}}}*/ … … 186 206 * For node i, Bi can be expressed in the actual coordinate system 187 207 * by: 188 * Bi=[ h ] 189 * [ h ] 190 * where h is the interpolation function for node i. 191 * 192 * We assume B_prog has been allocated already, of size: 2x(NDOF1*NUMNODESP1) 193 */ 194 195 IssmDouble basis[NUMNODESP1]; 196 197 /*Get dh1dh2dh3 in actual coordinate system: */ 198 GetNodalFunctions(&basis[0],gauss); 208 * Bi=[ N ] 209 * [ N ] 210 * where N is the interpolation function for node i. 211 * 212 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes) 213 */ 214 215 /*Fetch number of nodes for this finite element*/ 216 int numnodes = this->NumberofNodes(); 217 218 /*Get nodal functions*/ 219 IssmDouble* basis=xNew<IssmDouble>(numnodes); 220 GetNodalFunctions(basis,gauss); 199 221 200 222 /*Build B: */ 201 for (int i=0;i<NUMNODESP1;i++){ 202 B[NUMNODESP1*0+i]=basis[i]; 203 B[NUMNODESP1*1+i]=basis[i]; 204 } 223 for (int i=0;i<numnodes;i++){ 224 B[numnodes*0+i]=basis[i]; 225 B[numnodes*1+i]=basis[i]; 226 } 227 228 /*Clean-up*/ 229 xDelete<IssmDouble>(basis); 205 230 } 206 231 /*}}}*/ … … 227 252 228 253 /*Build B': */ 229 for (int i=0;i< NUMNODESP1;i++){230 Bprime[NDOF2* NUMNODESP1*0+NDOF2*i+0] = 2.*dbasis[0*numnodes+i];231 Bprime[NDOF2* NUMNODESP1*0+NDOF2*i+1] = dbasis[1*numnodes+i];232 Bprime[NDOF2* NUMNODESP1*1+NDOF2*i+0] = dbasis[0*numnodes+i];233 Bprime[NDOF2* NUMNODESP1*1+NDOF2*i+1] = 2.*dbasis[1*numnodes+i];234 Bprime[NDOF2* NUMNODESP1*2+NDOF2*i+0] = dbasis[1*numnodes+i];235 Bprime[NDOF2* NUMNODESP1*2+NDOF2*i+1] = dbasis[0*numnodes+i];254 for (int i=0;i<numnodes;i++){ 255 Bprime[NDOF2*numnodes*0+NDOF2*i+0] = 2.*dbasis[0*numnodes+i]; 256 Bprime[NDOF2*numnodes*0+NDOF2*i+1] = dbasis[1*numnodes+i]; 257 Bprime[NDOF2*numnodes*1+NDOF2*i+0] = dbasis[0*numnodes+i]; 258 Bprime[NDOF2*numnodes*1+NDOF2*i+1] = 2.*dbasis[1*numnodes+i]; 259 Bprime[NDOF2*numnodes*2+NDOF2*i+0] = dbasis[1*numnodes+i]; 260 Bprime[NDOF2*numnodes*2+NDOF2*i+1] = dbasis[0*numnodes+i]; 236 261 } 237 262 … … 242 267 /*FUNCTION TriaRef::GetBprimeMacAyealStokes {{{*/ 243 268 void TriaRef::GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss){ 244 245 269 /*Compute Bprime matrix. Bprime=[Bprime1 Bprime2 Bprime3] where Bprimei is of size 3*NDOF2. 246 270 * For node i, Bprimei can be expressed in the actual coordinate system 247 271 * by: 248 * Bprimei=[ dh/dx 0 ] 249 * [ 0 dh/dy ] 250 * [ dh/dy dh/dx ] 251 * [ dh/dx dh/dy ] 252 * where h is the interpolation function for node i. 253 * 254 * We assume Bprime has been allocated already, of size: 3x(NDOF2*NUMNODESP1) 255 */ 256 257 /*Same thing in the actual coordinate system: */ 258 IssmDouble dbasis[NDOF2][NUMNODESP1]; 259 260 /*Get dh1dh2dh3 in actual coordinates system : */ 261 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss); 272 * Bprimei=[ dN/dx 0 ] 273 * [ 0 dN/dy ] 274 * [ dN/dy dN/dx ] 275 N [ dN/dx dN/dy ] 276 * where N is the interpolation function for node i. 277 * 278 * We assume Bprime has been allocated already, of size: 3x(NDOF2*numnodes) 279 */ 280 281 /*Fetch number of nodes for this finite element*/ 282 int numnodes = this->NumberofNodes(); 283 284 /*Get nodal functions*/ 285 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 286 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss); 262 287 263 288 /*Build Bprime: */ 264 for(int i=0;i<NUMNODESP1;i++){ 265 Bprime[NDOF2*NUMNODESP1*0+NDOF2*i+0]=dbasis[0][i]; 266 Bprime[NDOF2*NUMNODESP1*0+NDOF2*i+1]=0.; 267 Bprime[NDOF2*NUMNODESP1*1+NDOF2*i+0]=0.; 268 Bprime[NDOF2*NUMNODESP1*1+NDOF2*i+1]=dbasis[1][i]; 269 Bprime[NDOF2*NUMNODESP1*2+NDOF2*i+0]=dbasis[1][i]; 270 Bprime[NDOF2*NUMNODESP1*2+NDOF2*i+1]=dbasis[0][i]; 271 Bprime[NDOF2*NUMNODESP1*3+NDOF2*i+0]=dbasis[0][i]; 272 Bprime[NDOF2*NUMNODESP1*3+NDOF2*i+1]=dbasis[1][i]; 273 } 289 for(int i=0;i<numnodes;i++){ 290 Bprime[NDOF2*numnodes*0+NDOF2*i+0]=dbasis[0*numnodes+i]; 291 Bprime[NDOF2*numnodes*0+NDOF2*i+1]=0.; 292 Bprime[NDOF2*numnodes*1+NDOF2*i+0]=0.; 293 Bprime[NDOF2*numnodes*1+NDOF2*i+1]=dbasis[1*numnodes+i]; 294 Bprime[NDOF2*numnodes*2+NDOF2*i+0]=dbasis[1*numnodes+i]; 295 Bprime[NDOF2*numnodes*2+NDOF2*i+1]=dbasis[0*numnodes+i]; 296 Bprime[NDOF2*numnodes*3+NDOF2*i+0]=dbasis[0*numnodes+i]; 297 Bprime[NDOF2*numnodes*3+NDOF2*i+1]=dbasis[1*numnodes+i]; 298 } 299 300 /*Clean-up*/ 301 xDelete<IssmDouble>(dbasis); 274 302 } 275 303 /*}}}*/ … … 279 307 * For node i, Bi' can be expressed in the actual coordinate system 280 308 * by: 281 * Bi_prime=[ dh/dx ] 282 * [ dh/dy ] 283 * where h is the interpolation function for node i. 284 * 285 * We assume B' has been allocated already, of size: 3x(NDOF2*NUMNODESP1) 286 */ 287 288 /*Same thing in the actual coordinate system: */ 289 IssmDouble dbasis[NDOF2][NUMNODESP1]; 290 291 /*Get dh1dh2dh3 in actual coordinates system : */ 292 GetNodalFunctionsDerivatives(&dbasis[0][0],xyz_list,gauss); 309 * Bi_prime=[ dN/dx ] 310 * [ dN/dy ] 311 * where N is the interpolation function for node i. 312 * 313 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes) 314 */ 315 316 /*Fetch number of nodes for this finite element*/ 317 int numnodes = this->NumberofNodes(); 318 319 /*Get nodal functions derivatives*/ 320 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 321 GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss); 293 322 294 323 /*Build B': */ 295 for(int i=0;i<NUMNODESP1;i++){ 296 Bprime[NUMNODESP1*0+i]=dbasis[0][i]; 297 Bprime[NUMNODESP1*1+i]=dbasis[1][i]; 298 } 324 for(int i=0;i<numnodes;i++){ 325 Bprime[numnodes*0+i]=dbasis[0*numnodes+i]; 326 Bprime[numnodes*1+i]=dbasis[1*numnodes+i]; 327 } 328 329 /*Clean-up*/ 330 xDelete<IssmDouble>(dbasis); 299 331 } 300 332 /*}}}*/ … … 308 340 * where N is the interpolation function for node i. 309 341 * 310 * We assume B has been allocated already, of size: 2 x (numdof*NUMNODESP1) 311 */ 312 313 int i; 314 IssmDouble basis[3]; 315 316 /*Get basis in actual coordinate system: */ 342 * We assume B has been allocated already, of size: 2 x (numdof*numnodes) 343 */ 344 345 /*Fetch number of nodes for this finite element*/ 346 int numnodes = this->NumberofNodes(); 347 348 /*Get nodal functions derivatives*/ 349 IssmDouble* basis=xNew<IssmDouble>(numnodes); 317 350 GetNodalFunctions(basis,gauss); 318 351 319 352 /*Build L: */ 320 for (i=0;i<NUMNODESP1;i++){ 321 B[2*NUMNODESP1*0+2*i+0]=basis[i]; //L[0][NDOF2*i]=dbasis[0][i]; 322 B[2*NUMNODESP1*0+2*i+1]=0.; 323 B[2*NUMNODESP1*1+2*i+0]=0.; 324 B[2*NUMNODESP1*1+2*i+1]=basis[i]; 325 } 353 for(int i=0;i<numnodes;i++){ 354 B[2*numnodes*0+2*i+0]=basis[i]; 355 B[2*numnodes*0+2*i+1]=0.; 356 B[2*numnodes*1+2*i+0]=0.; 357 B[2*numnodes*1+2*i+1]=basis[i]; 358 } 359 360 /*Clean-up*/ 361 xDelete<IssmDouble>(basis); 326 362 } 327 363 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.