Changeset 8418
- Timestamp:
- 05/24/11 15:23:22 (14 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r8417 r8418 777 777 ElementMatrix* Penta::CreateKMatrixCouplingMacAyealPattynFriction(void){ 778 778 779 /*Constants*/ 780 const int numdof = NDOF2 *NUMVERTICES; 781 const int numdoftotal = NDOF4 *NUMVERTICES; 782 783 /*Intermediaries */ 784 int i,j,ig,analysis_type,drag_type; 785 double Jdet2d,slope_magnitude,alpha2; 786 double xyz_list[NUMVERTICES][3]; 787 double xyz_list_tria[NUMVERTICES2D][3]={0.0}; 788 double slope[3]={0.0,0.0,0.0}; 789 double MAXSLOPE=.06; // 6 % 790 double MOUNTAINKEXPONENT=10; 791 double L[2][numdof]; 792 double DL[2][2] ={{ 0,0 },{0,0}}; //for basal drag 793 double DL_scalar; 794 double Ke_gg[numdof][numdof] ={0.0}; 795 double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag 796 Friction *friction = NULL; 797 GaussPenta *gauss=NULL; 798 779 799 /*Initialize Element matrix and return if necessary*/ 780 800 if(IsOnShelf() || !IsOnBed()) return NULL; 781 782 Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria. 783 ElementMatrix* Ke=tria->CreateKMatrixCouplingMacAyealPattynFriction(); 784 delete tria->matice; delete tria; 785 801 ElementMatrix* Ke1=new ElementMatrix(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum); 802 ElementMatrix* Ke2=new ElementMatrix(nodes,NUMVERTICES,this->parameters,PattynApproximationEnum); 803 ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2); 804 delete Ke1; delete Ke2; 805 806 /*retrieve inputs :*/ 807 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 808 for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<2;j++) xyz_list_tria[i][j]=xyz_list[i][j]; 809 parameters->FindParam(&analysis_type,AnalysisTypeEnum); 810 inputs->GetParameterValue(&drag_type,DragTypeEnum); 811 Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input); 812 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input); 813 Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input); 814 Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input); 815 816 /*build friction object, used later on: */ 817 if (drag_type!=2)_error_(" non-viscous friction not supported yet!"); 818 friction=new Friction("2d",inputs,matpar,analysis_type); 819 820 /* Start looping on the number of gaussian points: */ 821 gauss=new GaussPenta(0,1,2,2); 822 for (ig=gauss->begin();ig<gauss->end();ig++){ 823 824 gauss->GaussPoint(ig); 825 826 /*Friction: */ 827 friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum); 828 829 // If we have a slope > 6% for this element, it means we are on a mountain. In this particular case, 830 //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */ 831 surface_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],gauss); 832 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2)); 833 834 if (slope_magnitude>MAXSLOPE){ 835 alpha2=pow((double)10,MOUNTAINKEXPONENT); 836 } 837 838 GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0],gauss); 839 GetL(&L[0][0], gauss,NDOF2); 840 841 DL_scalar=alpha2*gauss->weight*Jdet2d; 842 for (i=0;i<2;i++) DL[i][i]=DL_scalar; 843 844 /* Do the triple producte tL*D*L: */ 845 TripleMultiply( &L[0][0],2,numdof,1, 846 &DL[0][0],2,2,0, 847 &L[0][0],2,numdof,0, 848 &Ke_gg_gaussian[0][0],0); 849 850 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j]; 851 } 852 853 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdoftotal+(numdof+j)]+=Ke_gg[i][j]; 854 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[(i+numdof)*numdoftotal+j]+=Ke_gg[i][j]; 855 856 /*Clean up and return*/ 857 delete gauss; 858 delete friction; 786 859 return Ke; 787 860 } -
issm/trunk/src/c/objects/Elements/Tria.cpp
r8417 r8418 904 904 return Ke; 905 905 } 906 /*}}}*/907 /*FUNCTION Tria::CreateKMatrixCouplingMacAyealPattynFriction {{{1*/908 ElementMatrix* Tria::CreateKMatrixCouplingMacAyealPattynFriction(void){909 910 /*Constants*/911 const int numdof = NDOF2 *NUMVERTICES;912 const int numdoftotal = NDOF4 *NUMVERTICES;913 914 /*Intermediaries */915 int i,j,ig,analysis_type,drag_type;916 double Jdet,slope_magnitude,alpha2;917 double xyz_list[NUMVERTICES][3];918 double slope[2]={0.0,0.0};919 double MAXSLOPE=.06; // 6 %920 double MOUNTAINKEXPONENT=10;921 double L[2][numdof];922 double DL[2][2] ={{ 0,0 },{0,0}}; //for basal drag923 double DL_scalar;924 double Ke_gg[numdof][numdof] ={0.0};925 double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix contribution from drag926 Friction *friction = NULL;927 GaussTria *gauss=NULL;928 929 /*Initialize Element matrix and return if necessary*/930 if(IsOnShelf()) return NULL;931 ElementMatrix* Ke1=new ElementMatrix(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);932 ElementMatrix* Ke2=new ElementMatrix(nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);933 ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);934 delete Ke1; delete Ke2;935 936 /*retrieve inputs :*/937 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);938 parameters->FindParam(&analysis_type,AnalysisTypeEnum);939 inputs->GetParameterValue(&drag_type,DragTypeEnum);940 Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input);941 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input);942 Input* vy_input=inputs->GetInput(VyEnum); _assert_(vy_input);943 Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input);944 945 /*build friction object, used later on: */946 if (drag_type!=2)_error_(" non-viscous friction not supported yet!");947 friction=new Friction("2d",inputs,matpar,analysis_type);948 949 /* Start looping on the number of gaussian points: */950 gauss=new GaussTria(2);951 for (ig=gauss->begin();ig<gauss->end();ig++){952 953 gauss->GaussPoint(ig);954 955 /*Friction: */956 friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum);957 958 // If we have a slope > 6% for this element, it means we are on a mountain. In this particular case,959 //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */960 surface_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],gauss);961 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2));962 963 if (slope_magnitude>MAXSLOPE){964 alpha2=pow((double)10,MOUNTAINKEXPONENT);965 }966 967 /* Get Jacobian determinant: */968 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);969 970 /*Get L matrix: */971 GetL(&L[0][0], &xyz_list[0][0], gauss,NDOF2);972 973 974 DL_scalar=alpha2*gauss->weight*Jdet;975 for (i=0;i<2;i++){976 DL[i][i]=DL_scalar;977 }978 979 /* Do the triple producte tL*D*L: */980 TripleMultiply( &L[0][0],2,numdof,1,981 &DL[0][0],2,2,0,982 &L[0][0],2,numdof,0,983 &Ke_gg_gaussian[0][0],0);984 985 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j];986 }987 988 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdoftotal+(numdof+j)]+=Ke_gg[i][j];989 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[(i+numdof)*numdoftotal+j]+=Ke_gg[i][j];990 991 /*Clean up and return*/992 delete gauss;993 delete friction;994 return Ke;995 }996 906 /*}}}*/ 997 907 /*FUNCTION Tria::CreateKMatrixDiagnosticHutter{{{1*/ -
issm/trunk/src/c/objects/Elements/Tria.h
r8417 r8418 150 150 ElementMatrix* CreateKMatrixDiagnosticMacAyealViscous(void); 151 151 ElementMatrix* CreateKMatrixDiagnosticMacAyealFriction(void); 152 ElementMatrix* CreateKMatrixCouplingMacAyealPattynFriction(void);153 152 ElementMatrix* CreateKMatrixDiagnosticHutter(void); 154 153 ElementMatrix* CreateKMatrixMelting(void);
Note:
See TracChangeset
for help on using the changeset viewer.