Changeset 15326
- Timestamp:
- 06/22/13 21:18:51 (12 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Elements
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp
r15313 r15326 986 986 } 987 987 /*}}}*/ 988 /*FUNCTION PentaRef::GetNodalFunctions{{{*/ 989 void PentaRef::GetNodalFunctions(IssmDouble* basis,GaussPenta* gauss){ 990 /*This routine returns the values of the nodal functions at the gaussian point.*/ 991 992 _assert_(basis); 993 994 switch(this->element_type){ 995 case P1Enum: 996 case P1DGEnum: 997 basis[0]=gauss->coord1*(1.-gauss->coord4)/2.; 998 basis[1]=gauss->coord2*(1.-gauss->coord4)/2.; 999 basis[2]=gauss->coord3*(1.-gauss->coord4)/2.; 1000 basis[3]=gauss->coord1*(1.+gauss->coord4)/2.; 1001 basis[4]=gauss->coord2*(1.+gauss->coord4)/2.; 1002 basis[5]=gauss->coord3*(1.+gauss->coord4)/2.; 1003 return; 1004 case MINIEnum: 1005 basis[0]=gauss->coord1*(1.-gauss->coord4)/2.; 1006 basis[1]=gauss->coord2*(1.-gauss->coord4)/2.; 1007 basis[2]=gauss->coord3*(1.-gauss->coord4)/2.; 1008 basis[3]=gauss->coord1*(1.+gauss->coord4)/2.; 1009 basis[4]=gauss->coord2*(1.+gauss->coord4)/2.; 1010 basis[5]=gauss->coord3*(1.+gauss->coord4)/2.; 1011 basis[6]=27.*gauss->coord1*gauss->coord2*gauss->coord3*(1.+gauss->coord4)*(1.-gauss->coord4); 1012 return; 1013 default: 1014 _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet"); 1015 } 1016 } 1017 /*}}}*/ 1018 /*FUNCTION PentaRef::GetNodalFunctionsDerivatives{{{*/ 1019 void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussPenta* gauss){ 1020 1021 /*This routine returns the values of the nodal functions derivatives (with respect to the 1022 * actual coordinate system): */ 1023 IssmDouble Jinv[3][3]; 1024 1025 /*Fetch number of nodes for this finite element*/ 1026 int numnodes = this->NumberofNodes(); 1027 1028 /*Get nodal functions derivatives in reference triangle*/ 1029 IssmDouble* dbasis_ref=xNew<IssmDouble>(3*numnodes); 1030 GetNodalFunctionsDerivativesReference(dbasis_ref,gauss); 1031 1032 /*Get Jacobian invert: */ 1033 GetJacobianInvert(&Jinv[0][0], xyz_list, gauss); 1034 1035 /*Build dbasis: 1036 * 1037 * [dhi/dx]= Jinv'*[dhi/dr] 1038 * [dhi/dy] [dhi/ds] 1039 * [dhi/dz] [dhi/dzeta] 1040 */ 1041 1042 for(int i=0;i<numnodes;i++){ 1043 dbasis[numnodes*0+i]=Jinv[0][0]*dbasis_ref[0*numnodes+i]+Jinv[0][1]*dbasis_ref[1*numnodes+i]+Jinv[0][2]*dbasis_ref[2*numnodes+i]; 1044 dbasis[numnodes*1+i]=Jinv[1][0]*dbasis_ref[0*numnodes+i]+Jinv[1][1]*dbasis_ref[1*numnodes+i]+Jinv[1][2]*dbasis_ref[2*numnodes+i]; 1045 dbasis[numnodes*2+i]=Jinv[2][0]*dbasis_ref[0*numnodes+i]+Jinv[2][1]*dbasis_ref[1*numnodes+i]+Jinv[2][2]*dbasis_ref[2*numnodes+i]; 1046 } 1047 1048 } 1049 /*}}}*/ 1050 /*FUNCTION PentaRef::GetNodalFunctionsDerivativesReference{{{*/ 1051 void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussPenta* gauss){ 1052 1053 /*This routine returns the values of the nodal functions derivatives (with respect to the 1054 * natural coordinate system) at the gaussian point. */ 1055 1056 _assert_(dbasis && gauss); 1057 1058 /*Get current coordinates in reference element*/ 1059 IssmDouble r=gauss->coord2-gauss->coord1; 1060 IssmDouble s=-3.0/SQRT3*(gauss->coord1+gauss->coord2-2.0/3.0); 1061 IssmDouble zeta=gauss->coord4; 1062 1063 switch(this->element_type){ 1064 case P1Enum: case P1DGEnum: 1065 /*Nodal function 1*/ 1066 dbasis[NUMNODESP1*0+0]=-0.5*(1.0-zeta)/2.0; 1067 dbasis[NUMNODESP1*1+0]=-SQRT3/6.0*(1.0-zeta)/2.0; 1068 dbasis[NUMNODESP1*2+0]=-0.5*(-0.5*r-SQRT3/6.0*s+ONETHIRD); 1069 /*Nodal function 2*/ 1070 dbasis[NUMNODESP1*0+1]=0.5*(1.0-zeta)/2.0; 1071 dbasis[NUMNODESP1*1+1]=-SQRT3/6.0*(1.0-zeta)/2.0; 1072 dbasis[NUMNODESP1*2+1]=-0.5*(0.5*r-SQRT3/6.0*s+ONETHIRD); 1073 /*Nodal function 3*/ 1074 dbasis[NUMNODESP1*0+2]=0; 1075 dbasis[NUMNODESP1*1+2]=SQRT3/3.0*(1.0-zeta)/2.0; 1076 dbasis[NUMNODESP1*2+2]=-0.5*(SQRT3/3.0*s+ONETHIRD); 1077 /*Nodal function 4*/ 1078 dbasis[NUMNODESP1*0+3]=-0.5*(1.0+zeta)/2.0; 1079 dbasis[NUMNODESP1*1+3]=-SQRT3/6.0*(1.0+zeta)/2.0; 1080 dbasis[NUMNODESP1*2+3]=0.5*(-0.5*r-SQRT3/6.0*s+ONETHIRD); 1081 /*Nodal function 5*/ 1082 dbasis[NUMNODESP1*0+4]=0.5*(1.0+zeta)/2.0; 1083 dbasis[NUMNODESP1*1+4]=-SQRT3/6.0*(1.0+zeta)/2.0; 1084 dbasis[NUMNODESP1*2+4]=0.5*(0.5*r-SQRT3/6.0*s+ONETHIRD); 1085 /*Nodal function 6*/ 1086 dbasis[NUMNODESP1*0+5]=0; 1087 dbasis[NUMNODESP1*1+5]=SQRT3/3.0*(1.0+zeta)/2.0; 1088 dbasis[NUMNODESP1*2+5]=0.5*(SQRT3/3.0*s+ONETHIRD); 1089 case MINIEnum: 1090 /*Nodal function 1*/ 1091 dbasis[NUMNODESMINI*0+0]=-0.5*(1.0-zeta)/2.0; 1092 dbasis[NUMNODESMINI*1+0]=-SQRT3/6.0*(1.0-zeta)/2.0; 1093 dbasis[NUMNODESMINI*2+0]=-0.5*(-0.5*r-SQRT3/6.0*s+ONETHIRD); 1094 /*Nodal function 2*/ 1095 dbasis[NUMNODESMINI*0+1]=0.5*(1.0-zeta)/2.0; 1096 dbasis[NUMNODESMINI*1+1]=-SQRT3/6.0*(1.0-zeta)/2.0; 1097 dbasis[NUMNODESMINI*2+1]=-0.5*(0.5*r-SQRT3/6.0*s+ONETHIRD); 1098 /*Nodal function 3*/ 1099 dbasis[NUMNODESMINI*0+2]=0; 1100 dbasis[NUMNODESMINI*1+2]=SQRT3/3.0*(1.0-zeta)/2.0; 1101 dbasis[NUMNODESMINI*2+2]=-0.5*(SQRT3/3.0*s+ONETHIRD); 1102 /*Nodal function 4*/ 1103 dbasis[NUMNODESMINI*0+3]=-0.5*(1.0+zeta)/2.0; 1104 dbasis[NUMNODESMINI*1+3]=-SQRT3/6.0*(1.0+zeta)/2.0; 1105 dbasis[NUMNODESMINI*2+3]=0.5*(-0.5*r-SQRT3/6.0*s+ONETHIRD); 1106 /*Nodal function 5*/ 1107 dbasis[NUMNODESMINI*0+4]=0.5*(1.0+zeta)/2.0; 1108 dbasis[NUMNODESMINI*1+4]=-SQRT3/6.0*(1.0+zeta)/2.0; 1109 dbasis[NUMNODESMINI*2+4]=0.5*(0.5*r-SQRT3/6.0*s+ONETHIRD); 1110 /*Nodal function 6*/ 1111 dbasis[NUMNODESMINI*0+5]=0; 1112 dbasis[NUMNODESMINI*1+5]=SQRT3/3.0*(1.0+zeta)/2.0; 1113 dbasis[NUMNODESMINI*2+5]=0.5*(SQRT3/3.0*s+ONETHIRD); 1114 /*Nodal function 7*/ 1115 dbasis[NUMNODESMINI*0+6]=9.0/2.0*r*(1.0+zeta)*(zeta-1.0)*(SQRT3*s+1.0); 1116 dbasis[NUMNODESMINI*1+6]=9.0/4.0*(1+zeta)*(1-zeta)*(SQRT3*pow(s,2.0)-2.0*s-SQRT3*pow(r,2.0)); 1117 dbasis[NUMNODESMINI*2+6]=27*gauss->coord1*gauss->coord2*gauss->coord3*(-2.0*zeta); 1118 return; 1119 default: 1120 _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet"); 1121 } 1122 1123 1124 } 1125 /*}}}*/ 988 1126 /*FUNCTION PentaRef::GetNodalFunctionsMINI{{{*/ 989 1127 void PentaRef::GetNodalFunctionsMINI(IssmDouble* l1l7, GaussPenta* gauss){ … … 1136 1274 *(dl1dl6+NUMNODESP1*1+0)=-0.5/SQRT3*(1.0-z)/2.0; 1137 1275 *(dl1dl6+NUMNODESP1*2+0)=-0.5*A1; 1276 //dbasis[NUMNODESP1*0+0]=-0.5*(1.0-zeta)/2.0; 1277 //dbasis[NUMNODESP1*1+0]=-SQRT3/6.0*(1.0-zeta)/2.0; 1278 //dbasis[NUMNODESP1*2+0]=-0.5*(-0.5*r-SQRT3/6.0*s+ONETHIRD); 1138 1279 1139 1280 /*Second nodal function: The corresponding nodal function is N=A2*(1-z)/2. Its derivatives follow*/ … … 1250 1391 switch(this->element_type){ 1251 1392 case P1Enum: return NUMNODESP1; 1393 case MINIEnum: return NUMNODESMINI; 1252 1394 default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet"); 1253 1395 } -
issm/trunk-jpl/src/c/classes/Elements/PentaRef.h
r15313 r15326 22 22 23 23 /*Numerics*/ 24 void GetNodalFunctions(IssmDouble* basis, GaussPenta* gauss); 25 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,GaussPenta* gauss); 26 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussPenta* gauss); 24 27 void GetNodalFunctionsP1(IssmDouble* l1l6, GaussPenta* gauss); 25 28 void GetNodalFunctionsMINI(IssmDouble* l1l7, GaussPenta* gauss); -
issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp
r15324 r15326 491 491 /*This routine returns the values of the nodal functions derivatives (with respect to the 492 492 * actual coordinate system): */ 493 IssmDouble Jinv[ NDOF2][NDOF2];493 IssmDouble Jinv[2][2]; 494 494 495 495 /*Fetch number of nodes for this finite element*/ -
issm/trunk-jpl/src/c/classes/Elements/TriaRef.h
r15313 r15326 27 27 void GetBprimeMacAyeal(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss); 28 28 void GetBprimeMacAyealStokes(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss); 29 void GetBprimePrognostic(IssmDouble* Bprime _prog, IssmDouble* xyz_list, GaussTria* gauss);30 void GetBPrognostic(IssmDouble* B _prog, IssmDouble* xyz_list, GaussTria* gauss);29 void GetBprimePrognostic(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTria* gauss); 30 void GetBPrognostic(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss); 31 31 void GetBHydro(IssmDouble* B, IssmDouble* xyz_list, GaussTria* gauss); 32 32 void GetBMacAyealFriction(IssmDouble* L, IssmDouble* xyz_list,GaussTria* gauss); … … 39 39 void GetSegmentBFlux(IssmDouble* B,GaussTria* gauss, int index1,int index2); 40 40 void GetSegmentBprimeFlux(IssmDouble* Bprime,GaussTria* gauss, int index1,int index2); 41 void GetNodalFunctionsDerivatives(IssmDouble* basis,IssmDouble* xyz_list, GaussTria* gauss);42 void GetNodalFunctionsDerivativesReference(IssmDouble* d l1dl3,GaussTria* gauss);41 void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTria* gauss); 42 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTria* gauss); 43 43 void GetInputValue(IssmDouble* pp, IssmDouble* plist, GaussTria* gauss); 44 44 void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss);
Note:
See TracChangeset
for help on using the changeset viewer.