Changeset 16874
- Timestamp:
- 11/21/13 19:01:27 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
r16872 r16874 975 975 }/*}}}*/ 976 976 ElementMatrix* StressbalanceAnalysis::CreateKMatrixSSAFriction(Element* element){/*{{{*/ 977 978 /*Return if element is inactive*/ 979 if(element->IsFloating()) return NULL; 980 977 981 /*Intermediaries*/ 978 982 bool mainlyfloating; 979 int analysis_type,migration_style,point1; 980 IssmDouble alpha2,Jdet,fraction1,fraction2; 981 IssmDouble phi=1.0; 982 IssmDouble D_scalar,gllevelset; 983 IssmDouble *xyz_list = NULL; 984 Friction *friction = NULL; 985 Gauss* gauss = NULL; 986 987 /*Return if element is inactive*/ 988 if(element->IsFloating()) return NULL; 983 int migration_style,point1; 984 IssmDouble alpha2,Jdet,fraction1,fraction2; 985 IssmDouble gllevelset,phi=1.; 986 IssmDouble *xyz_list = NULL; 987 Gauss* gauss = NULL; 989 988 990 989 /*Fetch number of nodes and dof for this finite element*/ … … 993 992 994 993 /*Initialize Element matrix and vectors*/ 995 ElementMatrix* Ke = element->NewElementMatrix(SSAApproximationEnum);996 IssmDouble* B = xNew<IssmDouble>(2*numdof);997 IssmDouble * D = xNewZeroInit<IssmDouble>(2*2);994 ElementMatrix* Ke = element->NewElementMatrix(SSAApproximationEnum); 995 IssmDouble* B = xNew<IssmDouble>(2*numdof); 996 IssmDouble D[2][2] = {0.}; 998 997 999 998 /*Retrieve all inputs and parameters*/ 1000 999 element->GetVerticesCoordinates(&xyz_list); 1001 1000 element->FindParam(&migration_style,GroundinglineMigrationEnum); 1002 Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input); 1003 Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input); 1004 Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input); 1005 Input* gllevelset_input=NULL; 1006 element->FindParam(&analysis_type,AnalysisTypeEnum); 1001 Input* surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input); 1002 Input* vx_input = element->GetInput(VxEnum); _assert_(vx_input); 1003 Input* vy_input = element->GetInput(VyEnum); _assert_(vy_input); 1004 Input* gllevelset_input = NULL; 1007 1005 1008 1006 /*build friction object, used later on: */ 1009 //friction=new Friction("2d",inputs,matpar,analysis_type);1007 Friction* friction=new Friction(element,2); 1010 1008 1011 1009 /*Recover portion of element that is grounded*/ … … 1022 1020 /* Start looping on the number of gaussian points: */ 1023 1021 for(int ig=gauss->begin();ig<gauss->end();ig++){ 1024 1025 1022 gauss->GaussPoint(ig); 1026 1023 1027 //friction->GetAlpha2(&alpha2, gauss,VxEnum,VyEnum,VzEnum); 1028 alpha2=1.0; 1024 friction->GetAlpha2(&alpha2, gauss,vx_input,vy_input,NULL); 1029 1025 if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2; 1030 1026 if(migration_style==SubelementMigration2Enum){ 1031 1027 gllevelset_input->GetInputValue(&gllevelset, gauss); 1032 if(gllevelset<0 ) alpha2=0;1028 if(gllevelset<0.) alpha2=0.; 1033 1029 } 1034 1030 1035 1031 this->GetBSSAFriction(B, element, xyz_list, gauss); 1036 1032 element->JacobianDeterminant(&Jdet, xyz_list,gauss); 1037 D_scalar=alpha2*gauss->weight*Jdet; 1038 for(int i=0;i<2;i++) D[i*2+i]=D_scalar; 1033 for(int i=0;i<2;i++) D[i][i]=alpha2*gauss->weight*Jdet; 1039 1034 1040 1035 TripleMultiply(B,2,numdof,1, 1041 D,2,2,0,1036 &D[0][0],2,2,0, 1042 1037 B,2,numdof,0, 1043 1038 &Ke->values[0],1); … … 1051 1046 delete friction; 1052 1047 xDelete<IssmDouble>(xyz_list); 1053 xDelete<IssmDouble>(D);1054 1048 xDelete<IssmDouble>(B); 1055 1049 return Ke; … … 1252 1246 delete gauss; 1253 1247 return pe; 1254 return NULL;1255 1248 }/*}}}*/ 1256 1249 void StressbalanceAnalysis::GetBSSA(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
Note:
See TracChangeset
for help on using the changeset viewer.