Changeset 5769
- Timestamp:
- 09/13/10 12:03:37 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r5767 r5769 894 894 GetSolutionFromInputsDiagnosticStokes(solution); 895 895 } 896 else {896 else if (approximation==MacAyealApproximationEnum || approximation==PattynApproximationEnum ||approximation==HutterApproximationEnum){ 897 897 GetSolutionFromInputsDiagnosticHoriz(solution); 898 898 } 899 else if(approximation==MacAyealPattynApproximationEnum || approximation==PattynStokesApproximationEnum){ 900 return; //do nothing the elements around with update the solution 901 } 902 else ISSMERROR("approximation type : %i (%s) not implemented yet",approximation,EnumToString(approximation)); 899 903 } 900 904 else if(analysis_type==DiagnosticHutterAnalysisEnum){ … … 1888 1892 this->inputs->AddInput(new IntInput(ApproximationEnum,StokesApproximationEnum)); 1889 1893 } 1894 else if (*(iomodel->elements_type+index)==PattynStokesApproximationEnum){ 1895 this->inputs->AddInput(new IntInput(ApproximationEnum,PattynStokesApproximationEnum)); 1896 } 1890 1897 else if (*(iomodel->elements_type+index)==NoneApproximationEnum){ 1891 1898 this->inputs->AddInput(new IntInput(ApproximationEnum,NoneApproximationEnum)); … … 3988 3995 /*If the element is a coupling, do nothing: every grid is also on an other elements 3989 3996 * (as coupling is between MacAyeal and Pattyn) so the other element will take care of it*/ 3990 if(approximation==MacAyealPattynApproximationEnum){ 3991 return; 3992 } 3993 else{ 3994 GetDofList(&doflist,approximation); 3995 } 3997 GetDofList(&doflist,approximation); 3996 3998 3997 3999 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4445 4447 else if (approximation==MacAyealPattynApproximationEnum){ 4446 4448 InputUpdateFromSolutionDiagnosticMacAyealPattyn(solution); 4449 } 4450 else if (approximation==PattynStokesApproximationEnum){ 4451 InputUpdateFromSolutionDiagnosticPattynStokes(solution); 4447 4452 } 4448 4453 } … … 4707 4712 } 4708 4713 4714 /*}}}*/ 4715 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattynStokes {{{1*/ 4716 void Penta::InputUpdateFromSolutionDiagnosticPattynStokes(double* solution){ 4717 4718 int i; 4719 4720 const int numdofpervertexp=2; 4721 const int numdofpervertexs=4; 4722 const int numdofp=numdofpervertexp*NUMVERTICES; 4723 const int numdofs=numdofpervertexs*NUMVERTICES; 4724 int* doflistp=NULL; 4725 int* doflists=NULL; 4726 double pattyn_values[numdofp]; 4727 double stokes_values[numdofs]; 4728 double vx[NUMVERTICES]; 4729 double vy[NUMVERTICES]; 4730 double vz[NUMVERTICES]; 4731 double vel[NUMVERTICES]; 4732 int dummy; 4733 double pressure[NUMVERTICES]; 4734 double xyz_list[NUMVERTICES][3]; 4735 4736 double *vz_ptr = NULL; 4737 Penta *penta = NULL; 4738 4739 /*OK, we have to add results of this element for pattyn 4740 * and results from the penta at base for macayeal. Now recover results*/ 4741 4742 /*Get dof listof this element (pattyn dofs and stokes dofs): */ 4743 GetDofList(&doflistp,PattynApproximationEnum); 4744 GetDofList(&doflists,StokesApproximationEnum); 4745 4746 /*Get node data: */ 4747 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4748 4749 /*Use the dof list to index into the solution vector: */ 4750 for(i=0;i<numdofp;i++){ 4751 pattyn_values[i]=solution[doflistp[i]]; 4752 } 4753 for(i=0;i<numdofs;i++){ 4754 stokes_values[i]=solution[doflists[i]]; 4755 } 4756 4757 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 4758 for(i=0;i<NUMVERTICES;i++){ 4759 vx[i]=stokes_values[i*numdofpervertexs+0]+pattyn_values[i*numdofpervertexp+0]; 4760 vy[i]=stokes_values[i*numdofpervertexs+1]+pattyn_values[i*numdofpervertexp+1]; 4761 vz[i]=stokes_values[i*numdofpervertexs+2]; 4762 pressure[i]=stokes_values[i*numdofpervertexs+3]; 4763 } 4764 4765 /*Get Vz*/ 4766 Input* vz_input=inputs->GetInput(VzEnum); 4767 if (vz_input){ 4768 if (vz_input->Enum()!=PentaVertexInputEnum){ 4769 ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumToString(vz_input->Enum())); 4770 } 4771 vz_input->GetValuesPtr(&vz_ptr,&dummy); 4772 for(i=0;i<NUMVERTICES;i++) vz[i]=vz[i]+vz_ptr[i]; 4773 } 4774 else{ 4775 ISSMERROR("Cannot compute Vel there is no Vz input"); 4776 } 4777 4778 /*Now Compute vel*/ 4779 for(i=0;i<NUMVERTICES;i++) { 4780 vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 4781 } 4782 4783 /*Now, we have to move the previous Vx and Vy inputs to old 4784 * status, otherwise, we'll wipe them off: */ 4785 this->inputs->ChangeEnum(VxEnum,VxOldEnum); 4786 this->inputs->ChangeEnum(VyEnum,VyOldEnum); 4787 this->inputs->ChangeEnum(VzEnum,VzOldEnum); 4788 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 4789 4790 /*Add vx and vy as inputs to the tria element: */ 4791 this->inputs->AddInput(new PentaVertexInput(VxEnum,vx)); 4792 this->inputs->AddInput(new PentaVertexInput(VyEnum,vy)); 4793 this->inputs->AddInput(new PentaVertexInput(VzEnum,vz)); 4794 this->inputs->AddInput(new PentaVertexInput(VelEnum,vel)); 4795 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 4796 4797 /*Free ressources:*/ 4798 xfree((void**)&doflistp); 4799 xfree((void**)&doflists); 4800 } 4709 4801 /*}}}*/ 4710 4802 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHutter {{{1*/ -
issm/trunk/src/c/objects/Elements/Penta.h
r5746 r5769 168 168 void InputUpdateFromSolutionDiagnosticMacAyealPattyn( double* solutiong); 169 169 void InputUpdateFromSolutionDiagnosticPattyn( double* solutiong); 170 void InputUpdateFromSolutionDiagnosticPattynStokes( double* solutiong); 170 171 void InputUpdateFromSolutionDiagnosticHutter( double* solutiong); 171 172 void InputUpdateFromSolutionDiagnosticVert( double* solutiong);
Note:
See TracChangeset
for help on using the changeset viewer.