Changeset 5880


Ignore:
Timestamp:
09/17/10 17:42:40 (15 years ago)
Author:
seroussi
Message:

more cleaning

File:
1 edited

Legend:

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

    r5879 r5880  
    34673467void  Tria::CreatePVectorBalancedthickness_CG(Vec pg ){
    34683468
    3469         /* local declarations */
    3470         int             i,j;
    3471 
    3472         /* node data: */
     3469        /*Constants*/
    34733470        const int    numdof=NDOF1*NUMVERTICES;
    3474         double       xyz_list[NUMVERTICES][3];
    3475         int*         doflist=NULL;
    3476         int          numberofdofspernode=1;
    3477 
    3478         /* gaussian points: */
    3479         int     ig;
     3471       
     3472        /*Intermediaries */
     3473        int        i,j,ig;
     3474        int*       doflist=NULL;
     3475        double     xyz_list[NUMVERTICES][3];
     3476        double     dhdt_g,melting_g,accumulation_g,Jdettria;
     3477        double     L[NUMVERTICES];
     3478        double     pe_g[NUMVERTICES]                        ={0.0};
    34803479        GaussTria* gauss=NULL;
    3481 
    3482         /* matrix */
    3483         double pe_g[NUMVERTICES]={0.0};
    3484         double L[NUMVERTICES];
    3485         double Jdettria;
    3486 
    3487         /*input parameters for structural analysis (diagnostic): */
    3488         double  accumulation_g;
    3489         double  melting_g;
    3490         double  dhdt_g;
    34913480
    34923481        /* Get node coordinates and dof list: */
     
    35053494                gauss->GaussPoint(ig);
    35063495
    3507                 /* Get Jacobian determinant: */
    3508                 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);
    3509 
    3510                 /*Get L matrix: */
    3511                 GetL(&L[0], &xyz_list[0][0], gauss,numberofdofspernode);
    3512 
    3513                 /* Get accumulation, melting at gauss point */
    35143496                accumulation_input->GetParameterValue(&accumulation_g,gauss);
    35153497                melting_input->GetParameterValue(&melting_g,gauss);
    35163498                dhdt_input->GetParameterValue(&dhdt_g,gauss);
    35173499
    3518                 /* Add value into pe_g: */
     3500                GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);
     3501                GetL(&L[0], &xyz_list[0][0], gauss,NDOF1);
     3502
    35193503                for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss->weight*(accumulation_g-melting_g-dhdt_g)*L[i];
    3520 
    3521         }
    3522 
    3523         /*Add pe_g to global matrix Kgg: */
     3504        }
     3505
    35243506        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    35253507
     
    35323514void  Tria::CreatePVectorBalancedthickness_DG(Vec pg){
    35333515
    3534         /* local declarations */
    3535         int             i,j;
    3536 
    3537         /* node data: */
     3516        /*Constants*/
    35383517        const int    numdof=NDOF1*NUMVERTICES;
    3539         double       xyz_list[NUMVERTICES][3];
    3540         int*         doflist=NULL;
    3541         int          numberofdofspernode=1;
    3542 
    3543         /* gaussian points: */
    3544         int     ig;
     3518
     3519        /*Intermediaries */
     3520        int        i,j,ig;
     3521        int*       doflist=NULL;
     3522        double     xyz_list[NUMVERTICES][3];
     3523        double     melting_g,accumulation_g,dhdt_g,Jdettria;
     3524        double     L[NUMVERTICES];
     3525        double     pe_g[NUMVERTICES]                       ={0.0};
    35453526        GaussTria* gauss=NULL;
    3546 
    3547         /* matrix */
    3548         double pe_g[NUMVERTICES]={0.0};
    3549         double L[NUMVERTICES];
    3550         double Jdettria;
    3551 
    3552         /*input parameters for structural analysis (diagnostic): */
    3553         double  accumulation_g;
    3554         double  melting_g;
    3555         double  dhdt_g;
    35563527
    35573528        /* Get node coordinates and dof list: */
     
    35703541                gauss->GaussPoint(ig);
    35713542
    3572                 /* Get Jacobian determinant: */
    3573                 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);
    3574 
    3575                 /*Get L matrix: */
    3576                 GetL(&L[0], &xyz_list[0][0], gauss,numberofdofspernode);
    3577 
    3578                 /* Get accumulation, melting and thickness at gauss point */
    35793543                accumulation_input->GetParameterValue(&accumulation_g,gauss);
    35803544                melting_input->GetParameterValue(&melting_g,gauss);
    35813545                dhdt_input->GetParameterValue(&dhdt_g,gauss);
    35823546
    3583                 /* Add value into pe_g: */
    3584                 for( i=0; i<numdof; i++) pe_g[i]+=Jdettria*gauss->weight*(accumulation_g-melting_g-dhdt_g)*L[i];
    3585 
    3586         }
    3587 
    3588         /*Add pe_g to global matrix Kgg: */
     3547                GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);
     3548                GetL(&L[0], &xyz_list[0][0], gauss,NDOF1);
     3549
     3550                for(i=0;i<numdof;i++) pe_g[i]+=Jdettria*gauss->weight*(accumulation_g-melting_g-dhdt_g)*L[i];
     3551        }
     3552
    35893553        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    35903554
     
    36423606void  Tria::CreatePVectorDiagnosticBaseVert(Vec pg){
    36433607
    3644         int             i,j;
    3645 
    3646         /* node data: */
     3608        /*Constants*/
    36473609        const int    numdof=NDOF1*NUMVERTICES;
    3648         double       xyz_list[NUMVERTICES][3];
    3649         int*         doflist=NULL;
    3650 
    3651         /* gaussian points: */
    3652         int     ig;
     3610
     3611        /*Intermediaries */
     3612        int        i,j,ig;
     3613        int        approximation;
     3614        int*       doflist=NULL;
     3615        double     xyz_list[NUMVERTICES][3];
     3616        double     Jdet;
     3617        double     vx,vy,vz,dbdx,dbdy,meltingvalue;
     3618        double     slope[2];
     3619        double     L[NUMVERTICES];
     3620        double     pe_g[numdof]={0.0};
     3621        double     pe_g_gaussian[numdof];
    36533622        GaussTria* gauss=NULL;
    3654 
    3655         /* Jacobian: */
    3656         double Jdet;
    3657 
    3658         /*nodal functions: */
    3659         double l1l2l3[3];
    3660 
    3661         /*element vector at the gaussian points: */
    3662         double  pe_g[numdof]={0.0};
    3663         double  pe_g_gaussian[numdof];
    3664 
    3665         /* matrices: */
    3666         double L[NUMVERTICES];
    3667 
    3668         /*input parameters for structural analysis (diagnostic): */
    3669         double  vx,vy,vz;
    3670         double  meltingvalue;
    3671         double  slope[2];
    3672         double  dbdx,dbdy;
    3673         int     approximation;
    36743623
    36753624        /* Get node coordinates and dof list: */
     
    36793628        /*Retrieve all inputs we will be needing: */
    36803629        inputs->GetParameterValue(&approximation,ApproximationEnum);
     3630        Input* bed_input=inputs->GetInput(BedEnum);             ISSMASSERT(bed_input);
    36813631        Input* melting_input=inputs->GetInput(MeltingRateEnum); ISSMASSERT(melting_input);
    36823632        Input* vx_input=inputs->GetInput(VxEnum);               ISSMASSERT(vx_input);
     
    36863636                vzstokes_input=inputs->GetInput(VzStokesEnum);       ISSMASSERT(vzstokes_input);
    36873637        }
    3688         Input* bed_input=inputs->GetInput(BedEnum);             ISSMASSERT(bed_input);
    3689 
    3690         /*For icesheets: */
     3638
    36913639        /* Start  looping on the number of gaussian points: */
    36923640        gauss=new GaussTria(2);
     
    36953643                gauss->GaussPoint(ig);
    36963644
    3697                 /*Get melting at gaussian point: */
    36983645                melting_input->GetParameterValue(&meltingvalue, gauss);
    3699 
    3700                 /*Get velocity at gaussian point: */
     3646                bed_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
    37013647                vx_input->GetParameterValue(&vx, gauss);
    37023648                vy_input->GetParameterValue(&vy, gauss);
     
    37063652                else vz=0;
    37073653
    3708                 /*Get bed slope: */
    3709                 bed_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],gauss);
    37103654                dbdx=slope[0];
    37113655                dbdy=slope[1];
    37123656
    3713                 /* Get Jacobian determinant: */
    37143657                GetJacobianDeterminant3d(&Jdet, &xyz_list[0][0],gauss);
    3715 
    3716                 //Get L matrix if viscous basal drag present:
    37173658                GetL(&L[0], &xyz_list[0][0], gauss,NDOF1);
    37183659
    3719                 /*Build gaussian vector: */
    37203660                for(i=0;i<NUMVERTICES;i++){
    37213661                        pe_g_gaussian[i]=-Jdet*gauss->weight*(vx*dbdx+vy*dbdy-vz-meltingvalue)*L[i];
    37223662                }
    37233663
    3724                 /*Add pe_g_gaussian vector to pe_g: */
    37253664                for( i=0; i<numdof; i++)pe_g[i]+=pe_g_gaussian[i];
    3726 
    3727         }
    3728 
    3729         /*Add pe_g to global vector pg: */
     3665        }
     3666
    37303667        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    37313668
Note: See TracChangeset for help on using the changeset viewer.