Changeset 4912


Ignore:
Timestamp:
07/30/10 13:28:19 (15 years ago)
Author:
seroussi
Message:

moved CreateKMatrixHutter (of beam) -> now done in Penta directly

Location:
issm/trunk/src/c/objects/Elements
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/Beam.cpp

    r4910 r4912  
    249249double Beam::CostFunction(void){
    250250        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 
    269251}
    270252/*}}}*/
     
    840822
    841823/*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 connectivity
    891                 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 /*}}}*/
    902824/*FUNCTION Beam::CreatePVectorDiagnosticHutter{{{1*/
    903825
  • issm/trunk/src/c/objects/Elements/Beam.h

    r4910 r4912  
    6969                void       SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
    7070                double  CostFunction(void);
    71                 void       CreateKMatrix(Mat Kgg);
     71                void       CreateKMatrix(Mat Kgg){ISSMERROR("Not implemented yet");};
    7272                void       CreatePVector(Vec pg);
    7373                void     DeleteResults(void);
     
    112112                /*}}}*/
    113113                /*Beam specific routines: {{{1*/
    114                 void      CreateKMatrixDiagnosticHutter(Mat Kgg);
    115114                void      CreatePVectorDiagnosticHutter(Vec pg);
    116115                void      GetDofList(int* doflist,int* pnumberofdofs);
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r4906 r4912  
    22402240
    22412241        /*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       
    22452255        /*flags: */
    22462256        bool onwater;
    2247 
     2257       
    22482258        /*recover some inputs: */
    22492259        inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
    2250 
     2260       
    22512261        /*If on water, skip: */
    22522262        if(onwater)return;
    22532263
     2264        inputs->GetParameterValue(&onbed,ElementOnBedEnum);
     2265        inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
     2266
     2267        GetDofList(&doflist[0],&numberofdofspernode);
     2268
    22542269        /*Spawn 3 beam elements: */
    22552270        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);
    22622317
    22632318}
Note: See TracChangeset for help on using the changeset viewer.