Changeset 5678


Ignore:
Timestamp:
09/03/10 14:10:50 (15 years ago)
Author:
seroussi
Message:

remove ugly gauss in PVector Stokes

File:
1 edited

Legend:

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

    r5677 r5678  
    28072807
    28082808        /* Start  looping on the number of gaussian points: */
    2809         /* Start  looping on the number of gaussian points: */
    28102809        gauss=new GaussPenta(5,5);
    28112810        for (ig=gauss->begin();ig<gauss->end();ig++){
     
    37283727
    37293728        /* gaussian points: */
    3730         int     num_area_gauss;
    3731         int     igarea,igvert;
    3732         double* first_gauss_area_coord  =  NULL;
    3733         double* second_gauss_area_coord =  NULL;
    3734         double* third_gauss_area_coord  =  NULL;
    3735         double* vert_gauss_coord = NULL;
    3736         double* area_gauss_weights  =  NULL;
    3737         double* vert_gauss_weights  =  NULL;
    3738 
    3739         /* specific gaussian point: */
    3740         double  gauss_weight,area_gauss_weight,vert_gauss_weight;
    3741         double  gauss_coord[4];
    3742         double  gauss_coord_tria[3];
    3743 
    3744         int     area_order=5;
    3745         int       num_vert_gauss=5;
     3729        int     ig;
     3730        GaussPenta *gauss=NULL;
     3731        GaussTria  *gauss_tria=NULL;
    37463732
    37473733        double  epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
     
    38053791        GetDofList(&doflist,StokesApproximationEnum);
    38063792
    3807         /* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore
    3808                 get tria gaussian points as well as segment gaussian points. For tria gaussian
    3809                 points, order of integration is 2, because we need to integrate the product tB*D*B'
    3810                 which is a polynomial of degree 3 (see GaussLegendreTria for more details). For segment gaussian
    3811                 points, same deal, which yields 3 gaussian points.*/
    3812 
    3813         /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
    3814         gaussPenta( &num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights,&vert_gauss_coord, &vert_gauss_weights, area_order, num_vert_gauss);
    3815 
    38163793        /*Retrieve all inputs we will be needing: */
    38173794        vx_input=inputs->GetInput(VxEnum);
     
    38213798
    38223799        /* Start  looping on the number of gaussian points: */
    3823         for (igarea=0; igarea<num_area_gauss; igarea++){
    3824                 for (igvert=0; igvert<num_vert_gauss; igvert++){
    3825                         /*Pick up the gaussian point: */
    3826                         area_gauss_weight=*(area_gauss_weights+igarea);
    3827                         vert_gauss_weight=*(vert_gauss_weights+igvert);
    3828                         gauss_weight=area_gauss_weight*vert_gauss_weight;
    3829                         gauss_coord[0]=*(first_gauss_area_coord+igarea);
    3830                         gauss_coord[1]=*(second_gauss_area_coord+igarea);
    3831                         gauss_coord[2]=*(third_gauss_area_coord+igarea);
    3832                         gauss_coord[3]=*(vert_gauss_coord+igvert);
    3833 
    3834                         /*Compute strain rate and viscosity: */
    3835                         this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss_coord,vx_input,vy_input,vz_input);
    3836                         matice->GetViscosity3dStokes(&viscosity,&epsilon[0]);
    3837 
    3838                         /* Get Jacobian determinant: */
    3839                         GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_coord);
    3840 
    3841                         /* Get nodal functions */
    3842                         GetNodalFunctionsMINI(&l1l7[0], gauss_coord);
    3843 
    3844                         /* Build gaussian vector */
    3845                         for(i=0;i<NUMVERTICES+1;i++){
    3846                                 Pe_gaussian[i*NDOF4+2]=-rho_ice*gravity*Jdet*gauss_weight*l1l7[i];
    3847                         }
    3848 
    3849                         /*Add Pe_gaussian to terms in Pe_temp. Watch out for column orientation from matlab: */
    3850                         for(i=0;i<27;i++){
    3851                                 Pe_temp[i]+=Pe_gaussian[i];
    3852                         }
    3853 
    3854                         /*Get B and Bprime matrices: */
    3855                         GetBStokes(&B[0][0],&xyz_list[0][0],gauss_coord);
    3856                         GetBprimeStokes(&B_prime[0][0],&xyz_list[0][0], gauss_coord);
    3857 
    3858                         /*Get bubble part of Bprime */
    3859                         for(i=0;i<8;i++){
    3860                                 for(j=0;j<3;j++){
    3861                                         B_prime_bubble[i][j]=B_prime[i][j+24];
    3862                                 }
    3863                         }
    3864 
    3865                         /* Build the D matrix: we plug the gaussian weight, the thickness, the viscosity, and the jacobian determinant
    3866                          * onto this scalar matrix, so that we win some computational time: */
    3867                         D_scalar=gauss_weight*Jdet;
    3868                         for (i=0;i<6;i++){
    3869                                 D[i][i]=D_scalar*2*viscosity;
    3870                         }
    3871                         for (i=6;i<8;i++){
    3872                                 D[i][i]=-D_scalar*stokesreconditioning;
    3873                         }
    3874 
    3875                         /*  Do the triple product tB*D*Bprime: */
    3876                         MatrixMultiply(&B[0][0],8,27,1,&D[0][0],8,8,0,&tBD[0][0],0);
    3877                         MatrixMultiply(&tBD[0][0],27,8,0,&B_prime_bubble[0][0],8,3,0,&Ke_gaussian[0][0],0);
    3878 
    3879                         /*Add Ke_gaussian and Ke_gaussian to terms in pKe. Watch out for column orientation from matlab: */
    3880                         for(i=0;i<27;i++){
    3881                                 for(j=0;j<3;j++){
    3882                                         Ke_temp[i][j]+=Ke_gaussian[i][j];
    3883                                 }
    3884                         }
    3885                 }
     3800        gauss=new GaussPenta(5,5);
     3801        for (ig=gauss->begin();ig<gauss->end();ig++){
     3802
     3803                gauss->GaussPoint(ig);
     3804
     3805                /*Compute strain rate and viscosity: */
     3806                this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
     3807                matice->GetViscosity3dStokes(&viscosity,&epsilon[0]);
     3808
     3809                /* Get Jacobian determinant: */
     3810                GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
     3811
     3812                /* Get nodal functions */
     3813                GetNodalFunctionsMINI(&l1l7[0], gauss);
     3814
     3815                /* Build gaussian vector */
     3816                for(i=0;i<NUMVERTICES+1;i++){
     3817                        Pe_gaussian[i*NDOF4+2]=-rho_ice*gravity*Jdet*gauss->weight*l1l7[i];
     3818                }
     3819
     3820                /*Add Pe_gaussian to terms in Pe_temp. Watch out for column orientation from matlab: */
     3821                for(i=0;i<27;i++) Pe_temp[i]+=Pe_gaussian[i];
     3822
     3823                /*Get B and Bprime matrices: */
     3824                GetBStokes(&B[0][0],&xyz_list[0][0],gauss);
     3825                GetBprimeStokes(&B_prime[0][0],&xyz_list[0][0], gauss);
     3826
     3827                /*Get bubble part of Bprime */
     3828                for(i=0;i<8;i++) for(j=0;j<3;j++) B_prime_bubble[i][j]=B_prime[i][j+24];
     3829
     3830                /* Build the D matrix: we plug the gaussian weight, the thickness, the viscosity, and the jacobian determinant
     3831                 * onto this scalar matrix, so that we win some computational time: */
     3832                D_scalar=gauss->weight*Jdet;
     3833                for (i=0;i<6;i++) D[i][i]=D_scalar*2*viscosity;
     3834                for (i=6;i<8;i++) D[i][i]=-D_scalar*stokesreconditioning;
     3835
     3836                /*  Do the triple product tB*D*Bprime: */
     3837                MatrixMultiply(&B[0][0],8,27,1,&D[0][0],8,8,0,&tBD[0][0],0);
     3838                MatrixMultiply(&tBD[0][0],27,8,0,&B_prime_bubble[0][0],8,3,0,&Ke_gaussian[0][0],0);
     3839
     3840                /*Add Ke_gaussian and Ke_gaussian to terms in pKe. Watch out for column orientation from matlab: */
     3841                for(i=0;i<27;i++) for(j=0;j<3;j++) Ke_temp[i][j]+=Ke_gaussian[i][j];
    38863842        }
    38873843
     
    38953851                }
    38963852
    3897                 xfree((void**)&first_gauss_area_coord); xfree((void**)&second_gauss_area_coord); xfree((void**)&third_gauss_area_coord); xfree((void**)&area_gauss_weights);
    3898                 GaussLegendreTria (&num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights, 2);
    3899 
    39003853                /* Start looping on the number of gauss 2d (nodes on the bedrock) */
    3901                 for (igarea=0; igarea<num_area_gauss; igarea++){
    3902                         gauss_weight=*(area_gauss_weights+igarea);
    3903                         gauss_coord[0]=*(first_gauss_area_coord+igarea);
    3904                         gauss_coord[1]=*(second_gauss_area_coord+igarea);
    3905                         gauss_coord[2]=*(third_gauss_area_coord+igarea);
    3906                         gauss_coord[3]=-1;
    3907 
    3908                         gauss_coord_tria[0]=*(first_gauss_area_coord+igarea);
    3909                         gauss_coord_tria[1]=*(second_gauss_area_coord+igarea);
    3910                         gauss_coord_tria[2]=*(third_gauss_area_coord+igarea);
     3854                delete gauss; //gauss of previous loop
     3855                gauss=new GaussPenta();
     3856                gauss->GaussFaceTria(0,1,2,2);
     3857                gauss_tria=new GaussTria();
     3858                for (ig=gauss->begin();ig<gauss->end();ig++){
     3859
     3860                        gauss->GaussPoint(ig);
     3861                        gauss->SynchronizeGaussTria(gauss_tria);
    39113862
    39123863                        /*Get the Jacobian determinant */
    3913                         tria->GetJacobianDeterminant3d(&Jdet2d, &xyz_list_tria[0][0], gauss_coord_tria);
     3864                        tria->GetJacobianDeterminant3d(&Jdet2d, &xyz_list_tria[0][0], gauss_tria);
    39143865
    39153866                        /* Get bed at gaussian point */
    3916                         bed_input->GetParameterValue(&bed, gauss_coord);
     3867                        bed_input->GetParameterValue(&bed, gauss);
    39173868
    39183869                        /*Get L matrix : */
    3919                         GetNodalFunctionsP1(l1l6, gauss_coord);
     3870                        GetNodalFunctionsP1(l1l6, gauss);
    39203871
    39213872                        /*Get water_pressure at gaussian point */
     
    39273878                        for(i=0;i<NUMVERTICES2D;i++){
    39283879                                for(j=0;j<3;j++){
    3929                                         Pe_temp[i*NDOF4+j]+=water_pressure*gauss_weight*Jdet2d*l1l6[i]*bed_normal[j];
     3880                                        Pe_temp[i*NDOF4+j]+=water_pressure*gauss->weight*Jdet2d*l1l6[i]*bed_normal[j];
    39303881                                }
    39313882                        }
     
    39403891
    39413892        /*Free ressources:*/
    3942         xfree((void**)&first_gauss_area_coord);
    3943         xfree((void**)&second_gauss_area_coord);
    3944         xfree((void**)&third_gauss_area_coord);
    3945         xfree((void**)&area_gauss_weights);
    3946         xfree((void**)&vert_gauss_coord);
    3947         xfree((void**)&vert_gauss_weights);
     3893        delete gauss;
     3894        delete gauss_tria;
    39483895        xfree((void**)&doflist);
    39493896
Note: See TracChangeset for help on using the changeset viewer.