Changeset 5678
- Timestamp:
- 09/03/10 14:10:50 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r5677 r5678 2807 2807 2808 2808 /* Start looping on the number of gaussian points: */ 2809 /* Start looping on the number of gaussian points: */2810 2809 gauss=new GaussPenta(5,5); 2811 2810 for (ig=gauss->begin();ig<gauss->end();ig++){ … … 3728 3727 3729 3728 /* 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; 3746 3732 3747 3733 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ … … 3805 3791 GetDofList(&doflist,StokesApproximationEnum); 3806 3792 3807 /* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore3808 get tria gaussian points as well as segment gaussian points. For tria gaussian3809 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 gaussian3811 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 3816 3793 /*Retrieve all inputs we will be needing: */ 3817 3794 vx_input=inputs->GetInput(VxEnum); … … 3821 3798 3822 3799 /* 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]; 3886 3842 } 3887 3843 … … 3895 3851 } 3896 3852 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 3900 3853 /* 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); 3911 3862 3912 3863 /*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); 3914 3865 3915 3866 /* Get bed at gaussian point */ 3916 bed_input->GetParameterValue(&bed, gauss _coord);3867 bed_input->GetParameterValue(&bed, gauss); 3917 3868 3918 3869 /*Get L matrix : */ 3919 GetNodalFunctionsP1(l1l6, gauss _coord);3870 GetNodalFunctionsP1(l1l6, gauss); 3920 3871 3921 3872 /*Get water_pressure at gaussian point */ … … 3927 3878 for(i=0;i<NUMVERTICES2D;i++){ 3928 3879 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]; 3930 3881 } 3931 3882 } … … 3940 3891 3941 3892 /*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; 3948 3895 xfree((void**)&doflist); 3949 3896
Note:
See TracChangeset
for help on using the changeset viewer.