Changeset 15717
- Timestamp:
- 08/06/13 08:40:49 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tria.cpp ¶
r15715 r15717 6606 6606 ElementMatrix* Tria::CreateKMatrixPrognostic_DG(void){ 6607 6607 6608 /*Constants*/6609 const int numnodes=NUMVERTICES;6610 6611 6608 /*Intermediaries */ 6612 6609 int dim; 6613 6610 IssmDouble xyz_list[NUMVERTICES][3]; 6614 IssmDouble Jdettria, dt,vx,vy;6615 IssmDouble basis[NUMVERTICES]; 6616 IssmDouble B[2][NUMVERTICES];6617 IssmDouble Bprime[2][NUMVERTICES];6618 IssmDouble DL[2][2]={0.0}; 6619 IssmDouble DLprime[2][2]={0.0};6620 IssmDouble DL_scalar;6621 GaussTria *gauss=NULL;6622 6623 /*Initialize Element matrix*/6624 ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);6611 IssmDouble Jdettria,D_scalar,dt,vx,vy; 6612 6613 /*Fetch number of nodes for this finite element*/ 6614 int numnodes = this->NumberofNodes(); 6615 6616 /*Initialize Element matrix and vectors*/ 6617 ElementMatrix* Ke = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum); 6618 IssmDouble* basis = xNew<IssmDouble>(numnodes); 6619 IssmDouble* B = xNew<IssmDouble>(2*numnodes); 6620 IssmDouble* Bprime = xNew<IssmDouble>(2*numnodes); 6621 IssmDouble D[2][2]; 6625 6622 6626 6623 /*Retrieve all inputs and parameters*/ … … 6640 6637 6641 6638 /* Start looping on the number of gaussian points: */ 6642 gauss=new GaussTria(2);6639 GaussTria* gauss=new GaussTria(2); 6643 6640 for(int ig=gauss->begin();ig<gauss->end();ig++){ 6644 6641 … … 6649 6646 6650 6647 GetJacobianDeterminant(&Jdettria, &xyz_list[0][0],gauss); 6651 GetNodalFunctions( &basis[0],gauss);6652 6653 D L_scalar=gauss->weight*Jdettria;6654 6655 TripleMultiply( &basis[0],1,numnodes,1,6656 &D L_scalar,1,1,0,6657 &basis[0],1,numnodes,0,6648 GetNodalFunctions(basis,gauss); 6649 6650 D_scalar=gauss->weight*Jdettria; 6651 6652 TripleMultiply(basis,1,numnodes,1, 6653 &D_scalar,1,1,0, 6654 basis,1,numnodes,0, 6658 6655 &Ke->values[0],1); 6659 6656 6660 6657 /*WARNING: B and Bprime are inverted compared to usual prognostic!!!!*/ 6661 GetBPrognostic(&Bprime[0][0], &xyz_list[0][0], gauss); 6662 GetBprimePrognostic(&B[0][0], &xyz_list[0][0], gauss); 6663 6664 DL_scalar=-dt*gauss->weight*Jdettria; 6665 6666 DLprime[0][0]=DL_scalar*vx; 6667 DLprime[1][1]=DL_scalar*vy; 6668 6669 TripleMultiply( &B[0][0],2,numnodes,1, 6670 &DLprime[0][0],2,2,0, 6671 &Bprime[0][0],2,numnodes,0, 6658 GetBPrognostic(Bprime, &xyz_list[0][0], gauss); 6659 GetBprimePrognostic(B, &xyz_list[0][0], gauss); 6660 6661 D_scalar=-dt*gauss->weight*Jdettria; 6662 D[0][0]=D_scalar*vx; 6663 D[0][1]=0.; 6664 D[1][0]=0.; 6665 D[1][1]=D_scalar*vy; 6666 6667 TripleMultiply(B,2,numnodes,1, 6668 &D[0][0],2,2,0, 6669 Bprime,2,numnodes,0, 6672 6670 &Ke->values[0],1); 6673 6671 } 6674 6672 6675 6673 /*Clean up and return*/ 6674 xDelete<IssmDouble>(basis); 6675 xDelete<IssmDouble>(B); 6676 xDelete<IssmDouble>(Bprime); 6676 6677 delete gauss; 6677 6678 return Ke; … … 6744 6745 ElementVector* Tria::CreatePVectorPrognostic_DG(void){ 6745 6746 6746 /*Constants*/6747 const int numnodes=NUMVERTICES;6748 6749 6747 /*Intermediaries */ 6750 6748 IssmDouble Jdettria,dt; 6751 6749 IssmDouble surface_mass_balance_g,basal_melting_g,thickness_g; 6752 6750 IssmDouble xyz_list[NUMVERTICES][3]; 6753 IssmDouble basis[NUMVERTICES]; 6754 GaussTria* gauss=NULL; 6755 6756 /*Initialize Element vector*/ 6757 ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters); 6751 6752 /*Fetch number of nodes and dof for this finite element*/ 6753 int numnodes = this->NumberofNodes(); 6754 6755 /*Initialize Element vector and other vectors*/ 6756 ElementVector* pe = new ElementVector(nodes,numnodes,this->parameters); 6757 IssmDouble* basis = xNew<IssmDouble>(numnodes); 6758 6758 6759 6759 /*Retrieve all inputs and parameters*/ … … 6765 6765 6766 6766 /* Start looping on the number of gaussian points: */ 6767 gauss=new GaussTria(2);6767 GaussTria* gauss=new GaussTria(2); 6768 6768 for(int ig=gauss->begin();ig<gauss->end();ig++){ 6769 6769 … … 6771 6771 6772 6772 GetJacobianDeterminant(&Jdettria, &xyz_list[0][0],gauss); 6773 GetNodalFunctions( &basis[0],gauss);6773 GetNodalFunctions(basis,gauss); 6774 6774 6775 6775 surface_mass_balance_input->GetInputValue(&surface_mass_balance_g,gauss); … … 6781 6781 6782 6782 /*Clean up and return*/ 6783 xDelete<IssmDouble>(basis); 6783 6784 delete gauss; 6784 6785 return pe; … … 7055 7056 ElementMatrix* Tria::CreateKMatrixBalancethickness_DG(void){ 7056 7057 7057 /*Constants*/7058 const int numnodes=NUMVERTICES;7059 7060 7058 /*Intermediaries*/ 7061 int i,j,dim;7062 IssmDouble vx,vy, Jdettria;7059 int dim; 7060 IssmDouble vx,vy,D_scalar,Jdettria; 7063 7061 IssmDouble xyz_list[NUMVERTICES][3]; 7064 IssmDouble B[2][NUMVERTICES]; 7065 IssmDouble Bprime[2][NUMVERTICES]; 7066 IssmDouble DL[2][2]={0.0}; 7067 IssmDouble DL_scalar; 7068 GaussTria *gauss=NULL; 7069 7070 /*Initialize Element matrix*/ 7071 ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum); 7062 7063 /*Fetch number of nodes for this finite element*/ 7064 int numnodes = this->NumberofNodes(); 7065 7066 /*Initialize Element matrix and vectors*/ 7067 ElementMatrix* Ke = new ElementMatrix(nodes,numnodes,this->parameters,NoneApproximationEnum); 7068 IssmDouble* basis = xNew<IssmDouble>(numnodes); 7069 IssmDouble* B = xNew<IssmDouble>(2*numnodes); 7070 IssmDouble* Bprime = xNew<IssmDouble>(2*numnodes); 7071 IssmDouble D[2][2]; 7072 7072 7073 7073 /*Retrieve all inputs and parameters*/ … … 7078 7078 7079 7079 /*Start looping on the number of gaussian points:*/ 7080 gauss=new GaussTria(2);7080 GaussTria* gauss=new GaussTria(2); 7081 7081 for(int ig=gauss->begin();ig<gauss->end();ig++){ 7082 7082 … … 7085 7085 GetJacobianDeterminant(&Jdettria, &xyz_list[0][0],gauss); 7086 7086 /*WARNING: B and Bprime are inverted compared to usual prognostic!!!!*/ 7087 GetBPrognostic( &Bprime[0][0], &xyz_list[0][0],gauss);7088 GetBprimePrognostic( &B[0][0], &xyz_list[0][0],gauss);7087 GetBPrognostic(Bprime,&xyz_list[0][0],gauss); 7088 GetBprimePrognostic(B,&xyz_list[0][0],gauss); 7089 7089 7090 7090 vx_input->GetInputValue(&vx,gauss); 7091 7091 vy_input->GetInputValue(&vy,gauss); 7092 7092 7093 DL_scalar=-gauss->weight*Jdettria; 7094 DL[0][0]=DL_scalar*vx; 7095 DL[1][1]=DL_scalar*vy; 7096 7097 TripleMultiply( &B[0][0],2,numnodes,1, 7098 &DL[0][0],2,2,0, 7099 &Bprime[0][0],2,numnodes,0, 7093 D_scalar=-gauss->weight*Jdettria; 7094 D[0][0]=D_scalar*vx; 7095 D[0][1]=0.; 7096 D[1][0]=0.; 7097 D[1][1]=D_scalar*vy; 7098 7099 TripleMultiply(B,2,numnodes,1, 7100 &D[0][0],2,2,0, 7101 Bprime,2,numnodes,0, 7100 7102 &Ke->values[0],1); 7101 7103 } 7102 7104 7103 7105 /*Clean up and return*/ 7106 xDelete<IssmDouble>(basis); 7107 xDelete<IssmDouble>(B); 7108 xDelete<IssmDouble>(Bprime); 7104 7109 delete gauss; 7105 7110 return Ke; … … 7165 7170 ElementVector* Tria::CreatePVectorBalancethickness_DG(void){ 7166 7171 7167 /*Constants*/7168 const int numnodes=NUMVERTICES;7169 7170 7172 /*Intermediaries */ 7171 int i,j;7172 7173 IssmDouble xyz_list[NUMVERTICES][3]; 7173 7174 IssmDouble basal_melting_g,surface_mass_balance_g,dhdt_g,Jdettria; 7174 IssmDouble basis[NUMVERTICES]; 7175 GaussTria* gauss=NULL; 7176 7177 /*Initialize Element vector*/ 7178 ElementVector* pe=new ElementVector(nodes,NUMVERTICES,this->parameters); 7175 7176 /*Fetch number of nodes and dof for this finite element*/ 7177 int numnodes = this->NumberofNodes(); 7178 7179 /*Initialize Element vector and other vectors*/ 7180 ElementVector* pe = new ElementVector(nodes,numnodes,this->parameters); 7181 IssmDouble* basis = xNew<IssmDouble>(numnodes); 7179 7182 7180 7183 /*Retrieve all inputs and parameters*/ … … 7185 7188 7186 7189 /* Start looping on the number of gaussian points: */ 7187 gauss=new GaussTria(2);7190 GaussTria* gauss=new GaussTria(2); 7188 7191 for(int ig=gauss->begin();ig<gauss->end();ig++){ 7189 7192 … … 7195 7198 7196 7199 GetJacobianDeterminant(&Jdettria, &xyz_list[0][0],gauss); 7197 GetNodalFunctions( &basis[0],gauss);7198 7199 for(i =0;i<numnodes;i++) pe->values[i]+=Jdettria*gauss->weight*(surface_mass_balance_g-basal_melting_g-dhdt_g)*basis[i];7200 GetNodalFunctions(basis,gauss); 7201 7202 for(int i=0;i<numnodes;i++) pe->values[i]+=Jdettria*gauss->weight*(surface_mass_balance_g-basal_melting_g-dhdt_g)*basis[i]; 7200 7203 } 7201 7204 7202 7205 /*Clean up and return*/ 7206 xDelete<IssmDouble>(basis); 7203 7207 delete gauss; 7204 7208 return pe;
Note:
See TracChangeset
for help on using the changeset viewer.