Changeset 24313 for issm/trunk/src/c/classes/Elements/TriaRef.cpp
- Timestamp:
- 11/01/19 12:01:57 (5 years ago)
- Location:
- issm/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/c
- Property svn:ignore
-
issm/trunk/src/c/classes/Elements/TriaRef.cpp
r23189 r24313 33 33 /*Reference Element numerics*/ 34 34 void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/ 35 /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian 35 /*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian 36 36 * point specified by gauss_basis: 37 37 * dp/dx=plist[0]*dh1/dx+plist[1]*dh2/dx+plist[2]*dh3/dx … … 89 89 /*}}}*/ 90 90 void TriaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 91 /*The Jacobian is constant over the element, discard the gaussian points. 91 /*The Jacobian is constant over the element, discard the gaussian points. 92 92 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 93 93 … … 106 106 /*}}}*/ 107 107 void TriaRef::GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 108 /*The Jacobian determinant is constant over the element, discard the gaussian points. 108 /*The Jacobian determinant is constant over the element, discard the gaussian points. 109 109 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 110 110 IssmDouble J[2][2]; … … 120 120 /*}}}*/ 121 121 void TriaRef::GetJacobianDeterminant3D(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 122 /*The Jacobian determinant is constant over the element, discard the gaussian points. 122 /*The Jacobian determinant is constant over the element, discard the gaussian points. 123 123 * J is assumed to have been allocated of size NDOF2xNDOF2.*/ 124 124 IssmDouble J[2][2]; … … 157 157 case NoneEnum: 158 158 return; 159 case P0Enum: 159 case P0Enum: case P0DGEnum: 160 160 basis[0]=1.; 161 161 return; … … 202 202 void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/ 203 203 204 /*This routine returns the values of the nodal functions derivatives (with respect to the 204 /*This routine returns the values of the nodal functions derivatives (with respect to the 205 205 * actual coordinate system): */ 206 206 IssmDouble Jinv[2][2]; … … 211 211 /*Get nodal functions derivatives in reference triangle*/ 212 212 IssmDouble dbasis_ref[2*NUMNODESMAX]; 213 GetNodalFunctionsDerivativesReference(dbasis_ref,gauss,finiteelement); 213 GetNodalFunctionsDerivativesReference(dbasis_ref,gauss,finiteelement); 214 214 215 215 /*Get Jacobian invert: */ 216 216 GetJacobianInvert(&Jinv[0][0], xyz_list, gauss); 217 217 218 /*Build dbasis: 218 /*Build dbasis: 219 219 * [dhi/dx]= Jinv*[dhi/dr] 220 220 * [dhi/dy] [dhi/ds] … … 227 227 } 228 228 /*}}}*/ 229 void TriaRef::GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2,int finiteelement){/*{{{*/230 /*Compute B matrix. B=[phi1 phi2 -phi3 -phi4]231 *232 * and phi1=phi3 phi2=phi4233 *234 * We assume B has been allocated already, of size: 1x4235 */236 237 /*Fetch number of nodes for this finite element*/238 int numnodes = this->NumberofNodes(finiteelement);239 240 /*Get nodal functions*/241 IssmDouble* basis=xNew<IssmDouble>(numnodes);242 GetNodalFunctions(basis,gauss,finiteelement);243 244 /*Build B for this segment*/245 B[0] = +basis[index1];246 B[1] = +basis[index2];247 B[2] = -basis[index1];248 B[3] = -basis[index2];249 250 /*Clean-up*/251 xDelete<IssmDouble>(basis);252 }253 /*}}}*/254 void TriaRef::GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2,int finiteelement){/*{{{*/255 /*Compute Bprime matrix. Bprime=[phi1 phi2 phi3 phi4]256 *257 * and phi1=phi3 phi2=phi4258 *259 * We assume Bprime has been allocated already, of size: 1x4260 */261 262 /*Fetch number of nodes for this finite element*/263 int numnodes = this->NumberofNodes(finiteelement);264 265 /*Get nodal functions*/266 IssmDouble* basis=xNew<IssmDouble>(numnodes);267 GetNodalFunctions(basis,gauss,finiteelement);268 269 /*Build B'*/270 Bprime[0] = basis[index1];271 Bprime[1] = basis[index2];272 Bprime[2] = basis[index1];273 Bprime[3] = basis[index2];274 275 /*Clean-up*/276 xDelete<IssmDouble>(basis);277 }278 /*}}}*/279 229 void TriaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 280 /*The Jacobian determinant is constant over the element, discard the gaussian points. 230 /*The Jacobian determinant is constant over the element, discard the gaussian points. 281 231 * J is assumed to have been allocated*/ 282 232 … … 305 255 306 256 switch(finiteelement){ 257 case P0Enum: case P0DGEnum: 258 basis[0]=triabasis[0]; 259 xDelete<IssmDouble>(triabasis); 260 return; 307 261 case P1Enum: case P1DGEnum: 308 262 basis[0]=triabasis[index1]; … … 330 284 } 331 285 /*}}}*/ 286 void TriaRef::GetSegmentNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list_tria,Gauss* gauss,int index1,int index2,int finiteelement){/*{{{*/ 287 /*This routine returns the values of the nodal functions at the gaussian point.*/ 288 289 _assert_(index1>=0 && index1<3); 290 _assert_(index2>=0 && index2<3); 291 292 /*Fetch number of nodes for this finite element*/ 293 int numnodes = this->NumberofNodes(finiteelement); 294 295 /*Get nodal functions*/ 296 IssmDouble* dtriabasis=xNew<IssmDouble>(2*numnodes); 297 GetNodalFunctionsDerivatives(dtriabasis,xyz_list_tria,gauss,finiteelement); 298 299 switch(finiteelement){ 300 case P1Enum: case P1DGEnum: 301 dbasis[2*0+0] = dtriabasis[numnodes*0+index1]; 302 dbasis[2*0+1] = dtriabasis[numnodes*1+index1]; 303 dbasis[2*1+0] = dtriabasis[numnodes*0+index2]; 304 dbasis[2*1+1] = dtriabasis[numnodes*1+index2]; 305 break; 306 default: 307 _error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet"); 308 } 309 310 /*Clean up*/ 311 xDelete<IssmDouble>(dtriabasis); 312 } 313 /*}}}*/ 332 314 void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){/*{{{*/ 333 /*This routine returns the values of the nodal functions derivatives (with respect to the 315 /*This routine returns the values of the nodal functions derivatives (with respect to the 334 316 * natural coordinate system) at the gaussian point. */ 335 317 … … 341 323 342 324 switch(finiteelement){ 343 case P0Enum: 325 case P0Enum: case P0DGEnum: 344 326 /*Nodal function 1*/ 345 327 dbasis[NUMNODESP0*0+0] = 0.; … … 484 466 case NoneEnum: return 0; 485 467 case P0Enum: return NUMNODESP0; 468 case P0DGEnum: return NUMNODESP0; 486 469 case P1Enum: return NUMNODESP1; 487 470 case P1DGEnum: return NUMNODESP1;
Note:
See TracChangeset
for help on using the changeset viewer.