Changeset 15438
- Timestamp:
- 07/05/13 12:50:39 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r15436 r15438 6894 6894 ElementMatrix* Penta::CreateKMatrixDiagnosticStokesGLSViscous(void){ 6895 6895 6896 int numdof = NDOF4*NUMVERTICES; 6896 int numdof = NUMVERTICES*NDOF4; 6897 int numvert = NUMVERTICES; 6897 6898 6898 6899 /*Intermediaries */ 6899 6900 int i,j,approximation; 6900 IssmDouble Jdet,viscosity,stokesreconditioning ;6901 IssmDouble Jdet,viscosity,stokesreconditioning,diameter,rigidity; 6901 6902 IssmDouble xyz_list[NUMVERTICES][3]; 6902 6903 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 6903 6904 IssmDouble B[8][24]; 6904 6905 IssmDouble B_prime[8][24]; 6905 IssmDouble D_scalar; 6906 IssmDouble B_stab[3][numvert]; 6907 IssmDouble D_scalar,D_scalar_stab; 6906 6908 IssmDouble D[8][8]={0.0}; 6909 IssmDouble D_stab[3][3]={0.0}; 6907 6910 IssmDouble Ke_temp[24][24]={0.0}; //for the six nodes 6911 IssmDouble Ke_temp_stab[6][6]={0.0}; //for the six nodes 6908 6912 GaussPenta *gauss=NULL; 6909 6913 … … 6920 6924 Input* vz_input=inputs->GetInput(VzEnum); _assert_(vz_input); 6921 6925 6926 /*Find minimal length and B*/ 6927 rigidity=material->GetB(); 6928 diameter=MinEdgeLength(xyz_list); 6929 6922 6930 /* Start looping on the number of gaussian points: */ 6923 6931 gauss=new GaussPenta(5,5); … … 6943 6951 6944 6952 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdof+j]+=Ke_temp[i][j]; 6953 6954 /*Add stabilization*/ 6955 D_scalar_stab=-gauss->weight*Jdet*1./3.*pow(diameter,2.)/(4.*1000*rigidity)*stokesreconditioning; 6956 GetBConduct(&B_stab[0][0],&xyz_list[0][0],gauss); 6957 6958 D_stab[0][0]=D_scalar_stab; D_stab[0][1]=0; D_stab[0][2]=0; 6959 D_stab[1][0]=0; D_stab[1][1]=D_scalar_stab; D_stab[1][2]=0; 6960 D_stab[2][0]=0; D_stab[2][1]=0; D_stab[2][2]=D_scalar_stab; 6961 6962 TripleMultiply(&B_stab[0][0],3,numvert,1, 6963 &D_stab[0][0],3,3,0, 6964 &B_stab[0][0],3,numvert,0, 6965 &Ke_temp_stab[0][0],1); 6966 6967 for(i=0;i<numvert;i++) for(j=0;j<numvert;j++) Ke->values[i*numdof*4+3+j*4+3]+=Ke_temp_stab[i][j]; 6968 6945 6969 } 6946 6970 … … 7781 7805 } 7782 7806 7783 if(IsOnBed() || IsOnSurface()){7784 IssmDouble xyz_list_tria[NUMVERTICES2D][3];7785 IssmDouble pi=3.141592653589793;7786 IssmDouble x,y,z;7787 IssmDouble basis[6]; //for the six nodes of the penta7788 GaussPenta *gauss=NULL;7789 Input* x_input=inputs->GetInput(MeshXEnum); _assert_(x_input);7790 Input* y_input=inputs->GetInput(MeshYEnum); _assert_(y_input);7791 Input* z_input=inputs->GetInput(MeshZEnum); _assert_(z_input);7792 7793 7794 if(IsOnBed()){7795 for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j];7796 gauss=new GaussPenta(0,1,2,2);7797 }7798 if(IsOnSurface()){7799 for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i+3][j];7800 gauss=new GaussPenta(3,4,5,2);7801 }7802 7803 7804 for(int ig=gauss->begin();ig<gauss->end();ig++){7805 7806 gauss->GaussPoint(ig);7807 7808 GetTriaJacobianDeterminant(&Jdet, &xyz_list_tria[0][0], gauss);7809 GetNodalFunctionsP1(basis, gauss);7810 x_input->GetInputValue(&x, gauss);7811 y_input->GetInputValue(&y, gauss);7812 z_input->GetInputValue(&z, gauss);7813 7814 7815 forcex=-((cos(2*pi*z)-1)*2*pi*sin(2*pi*y)*cos(2*pi*x)-2*(cos(2*pi*x)-1)*2*pi*sin(2*pi*y)*cos(2*pi*z))*1;7816 forcey=-((cos(2*pi*z)-1)*2*pi*sin(2*pi*x)*cos(2*pi*y)+(cos(2*pi*y)-1)*2*pi*sin(2*pi*x)*cos(2*pi*z))*1;7817 forcez=-(-2*pi*2*sin(2*pi*x)*sin(2*pi*y)*sin(2*pi*z)+sin(2*pi*x)*sin(2*pi*y)*sin(2*pi*z));7818 7819 if(IsOnBed()){7820 for(i=0;i<3;i++){7821 Pe_gaussian[i*NDOF4+0]+=forcex*Jdet*gauss->weight*basis[i]*-1.;7822 Pe_gaussian[i*NDOF4+1]+=forcey*Jdet*gauss->weight*basis[i]*-1.;7823 Pe_gaussian[i*NDOF4+2]+=forcez*Jdet*gauss->weight*basis[i]*-1.;7824 }7825 }7826 if(IsOnSurface()){7827 for(i=3;i<6;i++){7828 Pe_gaussian[i*NDOF4+0]+=forcex*Jdet*gauss->weight*basis[i]*1.;7829 Pe_gaussian[i*NDOF4+1]+=forcey*Jdet*gauss->weight*basis[i]*1.;7830 Pe_gaussian[i*NDOF4+2]+=forcez*Jdet*gauss->weight*basis[i]*1.;7831 }7832 }7833 }7834 }7835 7836 7807 /*Condensation*/ 7837 7808 ReduceVectorStokes(pe->values, &Ke_temp[0][0], &Pe_gaussian[0]); … … 7854 7825 int i,j; 7855 7826 int approximation; 7856 IssmDouble Jdet,gravity,rho_ice ;7857 IssmDouble forcex,forcey,forcez ;7827 IssmDouble Jdet,gravity,rho_ice,B,D_scalar_stab; 7828 IssmDouble forcex,forcey,forcez,diameter,stokesreconditioning; 7858 7829 IssmDouble xyz_list[NUMVERTICES][3]; 7859 7830 IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 7860 7831 IssmDouble l1l6[6]; //for the six nodes and the bubble 7832 IssmDouble dh1dh6[3][NUMVERTICES]; 7861 7833 IssmDouble Pe_gaussian[numdof]={0.0}; //for the six nodes and the bubble 7862 7834 GaussPenta *gauss=NULL; … … 7865 7837 inputs->GetInputValue(&approximation,ApproximationEnum); 7866 7838 if(approximation!=StokesApproximationEnum && approximation!=MacAyealStokesApproximationEnum && approximation!=PattynStokesApproximationEnum) return NULL; 7839 parameters->FindParam(&stokesreconditioning,DiagnosticStokesreconditioningEnum); 7867 7840 ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters,StokesApproximationEnum); 7868 7841 … … 7870 7843 rho_ice=matpar->GetRhoIce(); 7871 7844 gravity=matpar->GetG(); 7845 B=material->GetB(); 7872 7846 GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 7873 7847 Input* vx_input=inputs->GetInput(VxEnum); _assert_(vx_input); … … 7878 7852 Input* loadingforcez_input=inputs->GetInput(LoadingforceZEnum); _assert_(loadingforcez_input); 7879 7853 7854 /*Find minimal length*/ 7855 diameter=MinEdgeLength(xyz_list); 7856 7880 7857 /* Start looping on the number of gaussian points: */ 7881 7858 gauss=new GaussPenta(5,5); … … 7896 7873 Pe_gaussian[i*NDOF4+1]+=forcey*Jdet*gauss->weight*l1l6[i]; 7897 7874 Pe_gaussian[i*NDOF4+2]+=forcez*Jdet*gauss->weight*l1l6[i]; 7875 } 7876 7877 /*Add stabilization*/ 7878 D_scalar_stab=-gauss->weight*Jdet*1./3.*pow(diameter,2.)/(4.*1000*B)*stokesreconditioning; 7879 GetNodalFunctionsP1Derivatives(&dh1dh6[0][0],&xyz_list[0][0],gauss); 7880 7881 for(i=0;i<NUMVERTICES;i++){ 7882 Pe_gaussian[i*NDOF4+3]+=-rho_ice*gravity*D_scalar_stab*dh1dh6[2][i]; 7883 Pe_gaussian[i*NDOF4+3]+=forcex*D_scalar_stab*dh1dh6[0][i]; 7884 Pe_gaussian[i*NDOF4+3]+=forcey*D_scalar_stab*dh1dh6[1][i]; 7885 Pe_gaussian[i*NDOF4+3]+=forcez*D_scalar_stab*dh1dh6[2][i]; 7898 7886 } 7899 7887 }
Note:
See TracChangeset
for help on using the changeset viewer.