Ignore:
Timestamp:
09/15/10 10:18:38 (15 years ago)
Author:
Mathieu Morlighem
Message:

some cleaning

File:
1 edited

Legend:

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

    r5803 r5821  
    12751275
    12761276        int    i;
    1277         bool   found = false;
    12781277        Input *input = NULL;
    12791278
     
    23952394void  Tria::CreateKMatrixBalancedthickness_CG(Mat Kgg){
    23962395
    2397         /* local declarations */
    2398         int             i,j;
    2399 
    2400         /* node data: */
     2396        /*Constants*/
    24012397        const int    numdof=NDOF1*NUMVERTICES;
    2402         double       xyz_list[NUMVERTICES][3];
    2403         int*         doflist=NULL;
    2404 
    2405         /* gaussian points: */
    2406         int     ig;
    2407         GaussTria *gauss=NULL;
    2408 
    2409         /* matrices: */
    2410         double L[NUMVERTICES];
    2411         double B[2][NUMVERTICES];
    2412         double Bprime[2][NUMVERTICES];
    2413         double DL[2][2]={0.0};
    2414         double DLprime[2][2]={0.0};
    2415         double DL_scalar;
    2416         double Ke_gg[numdof][numdof]={0.0};//local element stiffness matrix
    2417         double Ke_gg_gaussian[numdof][numdof]={0.0}; //stiffness matrix evaluated at the gaussian point.
    2418         double Ke_gg_thickness1[numdof][numdof]={0.0}; //stiffness matrix evaluated at the gaussian point.
    2419         double Ke_gg_thickness2[numdof][numdof]={0.0}; //stiffness matrix evaluated at the gaussian point.
    2420 
    2421         double Jdettria;
    2422 
    2423         /*input parameters for structural analysis (diagnostic): */
    2424         double  dvx[2];
    2425         double  dvy[2];
    2426         double  vx,vy;
    2427         double  dvxdx,dvydy;
    2428         double  v_gauss[2]={0.0};
    2429 
    2430         double  K[2][2]={0.0};
    2431         double  KDL[2][2]={0.0};
    2432         int     found=0;
    2433         int     dim;
    2434 
    2435         /*inputs: */
    2436         Input* vxaverage_input=NULL;
    2437         Input* vyaverage_input=NULL;
    2438         bool artdiff;
     2398
     2399        /*Intermediaries */
     2400        bool       artdiff;
     2401        int        i,j,ig,dim;
     2402        double     Jdettria ,vx,vy,dvxdx,dvydy;
     2403        double     dvx[2],dvy[2];
     2404        double     xyz_list[NUMVERTICES][3];
     2405        double     L[NUMVERTICES];
     2406        double     B[2][NUMVERTICES];
     2407        double     Bprime[2][NUMVERTICES];
     2408        double     K[2][2]                          = {0.0};
     2409        double     KDL[2][2]                        = {0.0};
     2410        double     DL[2][2]                         = {0.0};
     2411        double     DLprime[2][2]                    = {0.0};
     2412        double     DL_scalar;
     2413        double     Ke_gg[numdof][numdof]            = {0.0};
     2414        double     Ke_gg_gaussian[numdof][numdof]   = {0.0};
     2415        double     Ke_gg_thickness1[numdof][numdof] = {0.0};
     2416        double     Ke_gg_thickness2[numdof][numdof] = {0.0};
     2417        int       *doflist                          = NULL;
     2418        GaussTria *gauss                            = NULL;
    24392419
    24402420        /* Get node coordinates and dof list: */
     
    24422422        GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
    24432423
    2444         /*retrieve some parameters: */
     2424        /*Retrieve all Inputs and parameters: */
    24452425        this->parameters->FindParam(&artdiff,ArtDiffEnum);
    24462426        this->parameters->FindParam(&dim,DimEnum);
    2447 
    2448         /*Retrieve all inputs we will be needed*/
     2427        Input* vxaverage_input=NULL;
     2428        Input* vyaverage_input=NULL;
    24492429        if(dim==2){
    24502430                vxaverage_input=inputs->GetInput(VxEnum); ISSMASSERT(vxaverage_input);
     
    24582438        //Create Artificial diffusivity once for all if requested
    24592439        if(artdiff){
    2460                 //Get the Jacobian determinant
    24612440                gauss=new GaussTria();
    24622441                gauss->GaussCenter();
     
    24642443                delete gauss;
    24652444
    2466                 //Build K matrix (artificial diffusivity matrix)
    2467                 vxaverage_input->GetParameterAverage(&v_gauss[0]);
    2468                 vyaverage_input->GetParameterAverage(&v_gauss[1]);
    2469 
    2470                 K[0][0]=pow(Jdettria,(double).5)/2.0*fabs(v_gauss[0]);
    2471                 K[1][1]=pow(Jdettria,(double).5)/2.0*fabs(v_gauss[1]);
     2445                vxaverage_input->GetParameterAverage(&vx);
     2446                vyaverage_input->GetParameterAverage(&vy);
     2447                K[0][0]=pow(Jdettria,(double).5)/2.0*fabs(vx);
     2448                K[1][1]=pow(Jdettria,(double).5)/2.0*fabs(vy);
    24722449        }
    24732450
     
    24782455                gauss->GaussPoint(ig);
    24792456
    2480                 /* Get Jacobian determinant: */
    24812457                GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);
    2482 
    2483                 /*Get B  and B prime matrix: */
    24842458                GetBPrognostic(&B[0][0], &xyz_list[0][0], gauss);
    24852459                GetBprimePrognostic(&Bprime[0][0], &xyz_list[0][0], gauss);
    24862460
    2487                 //Get vx, vy and their derivatives at gauss point
    24882461                vxaverage_input->GetParameterValue(&vx,gauss);
    24892462                vyaverage_input->GetParameterValue(&vy,gauss);
    2490 
    24912463                vxaverage_input->GetParameterDerivativeValue(&dvx[0],&xyz_list[0][0],gauss);
    24922464                vyaverage_input->GetParameterDerivativeValue(&dvy[0],&xyz_list[0][0],gauss);
     
    24942466                dvxdx=dvx[0];
    24952467                dvydy=dvy[1];
    2496 
    24972468                DL_scalar=gauss->weight*Jdettria;
    24982469
    2499                 //Create DL and DLprime matrix
    25002470                DL[0][0]=DL_scalar*dvxdx;
    25012471                DL[1][1]=DL_scalar*dvydy;
     
    25032473                DLprime[0][0]=DL_scalar*vx;
    25042474                DLprime[1][1]=DL_scalar*vy;
    2505 
    2506                 //Do the triple product tL*D*L.
    2507                 //Ke_gg_thickness=B'*DLprime*Bprime;
    25082475
    25092476                TripleMultiply( &B[0][0],2,numdof,1,
     
    25172484                                        &Ke_gg_thickness2[0][0],0);
    25182485
    2519                 /* Add the Ke_gg_gaussian, and optionally Ke_gg_drag_gaussian onto Ke_gg: */
    25202486                for( i=0; i<numdof; i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg_thickness1[i][j];
    25212487                for( i=0; i<numdof; i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg_thickness2[i][j];
    25222488
    25232489                if(artdiff){
    2524 
    2525                         /* Compute artificial diffusivity */
    25262490                        KDL[0][0]=DL_scalar*K[0][0];
    25272491                        KDL[1][1]=DL_scalar*K[1][1];
     
    25322496                                                &Ke_gg_gaussian[0][0],0);
    25332497
    2534                         /* Add artificial diffusivity matrix */
    25352498                        for( i=0; i<numdof; i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j];
    2536 
    25372499                }
    25382500        }
    25392501
    2540         /*Add Ke_gg to global matrix Kgg: */
    25412502        MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES);
    25422503
     
    25732534        /*input parameters for structural analysis (diagnostic): */
    25742535        double  vx,vy;
    2575         int     found;
    25762536        int     dim;
    25772537
     
    26662626        double  K[2][2]={0.0};
    26672627        double  KDL[2][2]={0.0};
    2668         int     found=0;
    26692628        int     dim;
    26702629
     
    27962755void  Tria::CreateKMatrixDiagnosticMacAyeal(Mat Kgg,Mat Kff, Mat Kfs){
    27972756       
    2798         const int      numdof         = 2 *NUMVERTICES;
     2757        /*Intermediaries*/
    27992758        double        *Ke_gg_viscous  = NULL;
    28002759        double        *Ke_gg_friction = NULL;
     
    28052764        Ke_gg_friction = CreateKMatrixDiagnosticMacAyealFriction();
    28062765
    2807         /*Initialize element matrix: */
     2766        /*Add Ke_gg values to Ke element stifness matrix: */
    28082767        Ke=this->NewElementMatrix(MacAyealApproximationEnum);
    2809 
    2810         /*Add Ke_gg values to Ke element stifness matrix: */
    28112768        if(Ke_gg_viscous) Ke->AddValues(Ke_gg_viscous);
    28122769        if(Ke_gg_friction)Ke->AddValues(Ke_gg_friction);
     
    28192776        xfree((void**)&Ke_gg_viscous);
    28202777        xfree((void**)&Ke_gg_friction);
    2821 
    2822 }
    2823 
     2778}
    28242779/*}}}*/
    28252780/*FUNCTION Tria::CreateKMatrixDiagnosticMacAyealViscous{{{1*/
     
    35473502        double  K[2][2]={0.0};
    35483503        double  KDL[2][2]={0.0};
    3549         int     found;
    35503504        int     dim;
    35513505
     
    37083662        /*input parameters for structural analysis (diagnostic): */
    37093663        double  vx,vy;
    3710         int     found;
    37113664        int     dim;
    37123665
     
    38383791
    38393792        int i,j;
    3840         int found=0;
    38413793       
    38423794        /* node data: */
     
    50985050void Tria::CreatePVectorThermalShelf( Vec pg){
    50995051
    5100         int i,found;
     5052        int i;
    51015053       
    51025054        const int  numdof=NUMVERTICES*NDOF1;
     
    51865138void Tria::CreatePVectorThermalSheet( Vec pg){
    51875139
    5188         int i,found;
     5140        int i;
    51895141       
    51905142        const int  numdof=NUMVERTICES*NDOF1;
     
    60165968        int* sinternaldoflist=NULL;
    60175969        int* sexternaldoflist=NULL;
    6018         bool symmetric=true;
     5970        bool square=true;
    60195971
    60205972        /*retrieve some parameters: */
     
    60375989        }
    60385990
    6039         /*Use symmetric constructor for ElementMatrix: */
    6040         if(!kff) Ke=new ElementMatrix(gsize,symmetric,gexternaldoflist);
    6041         else     Ke=new ElementMatrix(gsize,symmetric,finternaldoflist,fexternaldoflist,fsize,sinternaldoflist,sexternaldoflist,ssize);
     5991        /*Use square constructor for ElementMatrix: */
     5992        if(!kff) Ke=new ElementMatrix(gsize,square,gexternaldoflist);
     5993        else     Ke=new ElementMatrix(gsize,square,finternaldoflist,fexternaldoflist,fsize,sinternaldoflist,sexternaldoflist,ssize);
    60425994
    60435995        /*Free ressources and return:*/
     
    60816033        }
    60826034
    6083         /*Use symmetric constructor for ElementVector: */
     6035        /*constructor for ElementVector: */
    60846036        if(!kff)pe=new ElementVector(gsize,gexternaldoflist);
    60856037        else    pe=new ElementVector(gsize,finternaldoflist,fexternaldoflist,fsize);
Note: See TracChangeset for help on using the changeset viewer.