Changeset 4912
- Timestamp:
- 07/30/10 13:28:19 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Beam.cpp
r4910 r4912 249 249 double Beam::CostFunction(void){ 250 250 ISSMERROR(" not supported yet!"); 251 }252 /*}}}*/253 /*FUNCTION Beam::CreateKMatrix{{{1*/254 void Beam::CreateKMatrix(Mat Kgg){255 256 int analysis_type;257 258 /*retrive parameters: */259 parameters->FindParam(&analysis_type,AnalysisTypeEnum);260 261 /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */262 if (analysis_type==DiagnosticHutterAnalysisEnum) {263 CreateKMatrixDiagnosticHutter( Kgg);264 }265 else{266 ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));267 }268 269 251 } 270 252 /*}}}*/ … … 840 822 841 823 /*Beam specific routines: */ 842 /*FUNCTION Beam::CreateKMatrixDiagnosticHutter{{{1*/843 844 void Beam::CreateKMatrixDiagnosticHutter(Mat Kgg){845 846 847 const int numgrids=2;848 const int NDOF2=2;849 const int numdofs=NDOF2*numgrids;850 int doflist[numdofs];851 double Ke_gg[numdofs][numdofs]={{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};852 int numberofdofspernode;853 bool onbed;854 bool onsurface;855 int connectivity[2];856 double one0,one1;857 858 connectivity[0]=nodes[0]->GetConnectivity();859 connectivity[1]=nodes[1]->GetConnectivity();860 861 one0=1/(double)connectivity[0];862 one1=1/(double)connectivity[1];863 inputs->GetParameterValue(&onbed,ElementOnBedEnum);864 inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);865 866 GetDofList(&doflist[0],&numberofdofspernode);867 868 if (onbed && onsurface){869 Ke_gg[0][0]=one0;870 Ke_gg[1][1]=one0;871 Ke_gg[2][0]=-one1;872 Ke_gg[2][2]=one1;873 Ke_gg[3][1]=-one1;874 Ke_gg[3][3]=one1;875 }876 else if (onbed){877 Ke_gg[0][0]=one0;878 Ke_gg[1][1]=one0;879 Ke_gg[2][0]=-2*one1;880 Ke_gg[2][2]=2*one1;881 Ke_gg[3][1]=-2*one1;882 Ke_gg[3][3]=2*one1;883 }884 else if (onsurface){885 Ke_gg[2][0]=-one1;886 Ke_gg[2][2]=one1;887 Ke_gg[3][1]=-one1;888 Ke_gg[3][3]=one1;889 }890 else{ //node is on two horizontal layers and beams include the values only once, so the have to use half of the connectivity891 Ke_gg[2][0]=-2*one1;892 Ke_gg[2][2]=2*one1;893 Ke_gg[3][1]=-2*one1;894 Ke_gg[3][3]=2*one1;895 }896 897 /*Add Ke_gg to global matrix Kgg: */898 MatSetValues(Kgg,numdofs,doflist,numdofs,doflist,(const double*)Ke_gg,ADD_VALUES);899 900 }901 /*}}}*/902 824 /*FUNCTION Beam::CreatePVectorDiagnosticHutter{{{1*/ 903 825 -
issm/trunk/src/c/objects/Elements/Beam.h
r4910 r4912 69 69 void SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters); 70 70 double CostFunction(void); 71 void CreateKMatrix(Mat Kgg) ;71 void CreateKMatrix(Mat Kgg){ISSMERROR("Not implemented yet");}; 72 72 void CreatePVector(Vec pg); 73 73 void DeleteResults(void); … … 112 112 /*}}}*/ 113 113 /*Beam specific routines: {{{1*/ 114 void CreateKMatrixDiagnosticHutter(Mat Kgg);115 114 void CreatePVectorDiagnosticHutter(Vec pg); 116 115 void GetDofList(int* doflist,int* pnumberofdofs); -
issm/trunk/src/c/objects/Elements/Penta.cpp
r4906 r4912 2240 2240 2241 2241 /*Collapsed formulation: */ 2242 Beam* beam=NULL; 2243 int i; 2244 2242 int i; 2243 const int numgrids=6; 2244 const int NDOF2=2; 2245 const int numdofs=NDOF2*numgrids; 2246 int doflist[numdofs]; 2247 double Ke_gg[numdofs][numdofs]={0.0}; 2248 int numberofdofspernode; 2249 bool onbed; 2250 bool onsurface; 2251 int connectivity[2]; 2252 double one0,one1; 2253 int i0,i1,j0,j1; 2254 2245 2255 /*flags: */ 2246 2256 bool onwater; 2247 2257 2248 2258 /*recover some inputs: */ 2249 2259 inputs->GetParameterValue(&onwater,ElementOnWaterEnum); 2250 2260 2251 2261 /*If on water, skip: */ 2252 2262 if(onwater)return; 2253 2263 2264 inputs->GetParameterValue(&onbed,ElementOnBedEnum); 2265 inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum); 2266 2267 GetDofList(&doflist[0],&numberofdofspernode); 2268 2254 2269 /*Spawn 3 beam elements: */ 2255 2270 for(i=0;i<3;i++){ 2256 beam=(Beam*)SpawnBeam(i,i+3); //[0 3], [1 4] and [2 5] are the four vertical edges of the Penta 2257 beam->CreateKMatrix(Kgg); 2258 } 2259 2260 /*clean up*/ 2261 delete beam; 2271 /*2 dofs of first node*/ 2272 i0=2*i; 2273 i1=2*i+1; 2274 /*2 dofs of second node*/ 2275 j0=2*(i+3); 2276 j1=2*(i+3)+1; 2277 2278 /*Find connectivity for the two nodes*/ 2279 connectivity[0]=nodes[i]->GetConnectivity(); 2280 connectivity[1]=nodes[i+3]->GetConnectivity(); 2281 one0=1/(double)connectivity[0]; 2282 one1=1/(double)connectivity[1]; 2283 2284 /*Create matrix for these two nodes*/ 2285 if (onbed && onsurface){ 2286 Ke_gg[i0][i0]=one0; 2287 Ke_gg[i1][i1]=one0; 2288 Ke_gg[j0][i0]=-one1; 2289 Ke_gg[j0][j0]=one1; 2290 Ke_gg[j1][i1]=-one1; 2291 Ke_gg[j1][j1]=one1; 2292 } 2293 else if (onbed){ 2294 Ke_gg[i0][i0]=one0; 2295 Ke_gg[i1][i1]=one0; 2296 Ke_gg[j0][i0]=-2*one1; 2297 Ke_gg[j0][j0]=2*one1; 2298 Ke_gg[j1][i1]=-2*one1; 2299 Ke_gg[j1][j1]=2*one1; 2300 } 2301 else if (onsurface){ 2302 Ke_gg[j0][i0]=-one1; 2303 Ke_gg[j0][j0]=one1; 2304 Ke_gg[j1][i1]=-one1; 2305 Ke_gg[j1][j1]=one1; 2306 } 2307 else{ //node is on two horizontal layers and beams include the values only once, so the have to use half of the connectivity 2308 Ke_gg[j0][i0]=-2*one1; 2309 Ke_gg[j0][j0]=2*one1; 2310 Ke_gg[j1][i1]=-2*one1; 2311 Ke_gg[j1][j1]=2*one1; 2312 } 2313 } 2314 2315 /*Add Ke_gg to global matrix Kgg: */ 2316 MatSetValues(Kgg,numdofs,doflist,numdofs,doflist,(const double*)Ke_gg,ADD_VALUES); 2262 2317 2263 2318 }
Note:
See TracChangeset
for help on using the changeset viewer.