Changeset 15814
- Timestamp:
- 08/13/13 10:24:55 (12 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r15792 r15814 1024 1024 const IssmPDouble epsilon= 1.e-15; 1025 1025 IssmDouble phi,s1,s2,area_init,area_grounded; 1026 IssmDouble gl[ 3];1027 IssmDouble xyz_bis[ 3][3];1026 IssmDouble gl[NUMVERTICES]; 1027 IssmDouble xyz_bis[NUMVERTICES2D][3]; 1028 1028 1029 1029 /*Recover parameters and values*/ … … 1031 1031 1032 1032 /*Be sure that values are not zero*/ 1033 if(gl[0]==0 ) gl[0]=gl[0]+epsilon;1034 if(gl[1]==0 ) gl[1]=gl[1]+epsilon;1035 if(gl[2]==0 ) gl[2]=gl[2]+epsilon;1033 if(gl[0]==0.) gl[0]=gl[0]+epsilon; 1034 if(gl[1]==0.) gl[1]=gl[1]+epsilon; 1035 if(gl[2]==0.) gl[2]=gl[2]+epsilon; 1036 1036 1037 1037 /*Check that not all nodes are grounded or floating*/ … … 1048 1048 if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2 1049 1049 /*Coordinates of point 2: same as initial point 2*/ 1050 xyz_bis[2][0]= *(xyz_list+3*2+0);1051 xyz_bis[2][1]= *(xyz_list+3*2+1);1052 xyz_bis[2][2]= *(xyz_list+3*2+2);1050 xyz_bis[2][0]=xyz_list[3*2+0]; 1051 xyz_bis[2][1]=xyz_list[3*2+1]; 1052 xyz_bis[2][2]=xyz_list[3*2+2]; 1053 1053 1054 1054 /*Portion of the segments*/ … … 1057 1057 1058 1058 /*New point 1*/ 1059 xyz_bis[1][0]= *(xyz_list+3*2+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*2+0));1060 xyz_bis[1][1]= *(xyz_list+3*2+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*2+1));1061 xyz_bis[1][2]= *(xyz_list+3*2+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*2+2));1059 xyz_bis[1][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]); 1060 xyz_bis[1][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]); 1061 xyz_bis[1][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]); 1062 1062 1063 1063 /*New point 0*/ 1064 xyz_bis[0][0]= *(xyz_list+3*2+0)+s2*(*(xyz_list+3*0+0)-*(xyz_list+3*2+0));1065 xyz_bis[0][1]= *(xyz_list+3*2+1)+s2*(*(xyz_list+3*0+1)-*(xyz_list+3*2+1));1066 xyz_bis[0][2]= *(xyz_list+3*2+2)+s2*(*(xyz_list+3*0+2)-*(xyz_list+3*2+2));1064 xyz_bis[0][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]); 1065 xyz_bis[0][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]); 1066 xyz_bis[0][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]); 1067 1067 } 1068 1068 else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2 … … 1108 1108 1109 1109 /*Compute fraction of grounded element*/ 1110 Get JacobianDeterminant(&area_init, xyz_list,NULL);1111 Get JacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL);1110 GetTriaJacobianDeterminant(&area_init, xyz_list,NULL); 1111 GetTriaJacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL); 1112 1112 if(mainlyfloating==true) area_grounded=area_init-area_grounded; 1113 1113 phi=area_grounded/area_init; 1114 1114 } 1115 1115 1116 if(phi>1 || phi<0) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");1116 if(phi>1. || phi<0.) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1"); 1117 1117 1118 1118 return phi; … … 7660 7660 int analysis_type,migration_style; 7661 7661 IssmDouble xyz_list[NUMVERTICES][3]; 7662 IssmDouble xyz_list_tria[NUMVERTICES2D][3] ={0.};7662 IssmDouble xyz_list_tria[NUMVERTICES2D][3]; 7663 7663 IssmDouble alpha2,Jdet; 7664 7664 IssmDouble phi=1.0; … … 7693 7693 7694 7694 /*Recover portion of element that is grounded*/ 7695 if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list [0][0]);7695 if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list_tria[0][0]); 7696 7696 7697 7697 /* Start looping on the number of gaussian points: */ -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r15771 r15814 818 818 int point; 819 819 const IssmPDouble epsilon= 1.e-15; 820 IssmDouble gl[ 3];820 IssmDouble gl[NUMVERTICES]; 821 821 IssmDouble f1,f2; 822 822 … … 825 825 826 826 /*Be sure that values are not zero*/ 827 if(gl[0]==0 ) gl[0]=gl[0]+epsilon;828 if(gl[1]==0 ) gl[1]=gl[1]+epsilon;829 if(gl[2]==0 ) gl[2]=gl[2]+epsilon;827 if(gl[0]==0.) gl[0]=gl[0]+epsilon; 828 if(gl[1]==0.) gl[1]=gl[1]+epsilon; 829 if(gl[2]==0.) gl[2]=gl[2]+epsilon; 830 830 831 831 /*Check that not all nodes are grounded or floating*/ … … 869 869 /*Computeportion of the element that is grounded*/ 870 870 871 bool 872 const IssmPDouble epsilon= 1.e-15;871 bool mainlyfloating = true; 872 const IssmPDouble epsilon = 1.e-15; 873 873 IssmDouble phi,s1,s2,area_init,area_grounded; 874 IssmDouble gl[ 3];874 IssmDouble gl[NUMVERTICES]; 875 875 IssmDouble xyz_bis[3][3]; 876 876 … … 879 879 880 880 /*Be sure that values are not zero*/ 881 if(gl[0]==0 ) gl[0]=gl[0]+epsilon;882 if(gl[1]==0 ) gl[1]=gl[1]+epsilon;883 if(gl[2]==0 ) gl[2]=gl[2]+epsilon;881 if(gl[0]==0.) gl[0]=gl[0]+epsilon; 882 if(gl[1]==0.) gl[1]=gl[1]+epsilon; 883 if(gl[2]==0.) gl[2]=gl[2]+epsilon; 884 884 885 885 /*Check that not all nodes are grounded or floating*/
Note:
See TracChangeset
for help on using the changeset viewer.