Changeset 6150
- Timestamp:
- 10/04/10 13:17:49 (14 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r6141 r6150 830 830 GetSolutionFromInputsDiagnosticHoriz(solution); 831 831 } 832 else if (approximation==MacAyealPattynApproximationEnum || approximation==PattynStokesApproximationEnum ){832 else if (approximation==MacAyealPattynApproximationEnum || approximation==PattynStokesApproximationEnum || approximation==MacAyealStokesApproximationEnum){ 833 833 return; //the elements around will create the solution 834 834 } … … 4438 4438 InputUpdateFromSolutionDiagnosticPattynStokes(solution); 4439 4439 } 4440 else if (approximation==MacAyealStokesApproximationEnum){ 4441 InputUpdateFromSolutionDiagnosticMacAyealStokes(solution); 4442 } 4440 4443 else if (approximation==StokesApproximationEnum || approximation==NoneApproximationEnum){ 4441 4444 InputUpdateFromSolutionDiagnosticStokes(solution); … … 4627 4630 xfree((void**)&doflistp); 4628 4631 xfree((void**)&doflistm); 4632 } 4633 /*}}}*/ 4634 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes {{{1*/ 4635 void Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes(double* solution){ 4636 4637 int i; 4638 4639 const int numdofm=NDOF2*NUMVERTICES; 4640 const int numdofs=NDOF4*NUMVERTICES; 4641 const int numdof2d=NDOF2*NUMVERTICES2D; 4642 int* doflistm=NULL; 4643 int* doflists=NULL; 4644 double macayeal_values[numdofm]; 4645 double stokes_values[numdofs]; 4646 double vx[NUMVERTICES]; 4647 double vy[NUMVERTICES]; 4648 double vz[NUMVERTICES]; 4649 double vzmacayeal[NUMVERTICES]; 4650 double vzstokes[NUMVERTICES]; 4651 double vel[NUMVERTICES]; 4652 int dummy; 4653 double pressure[NUMVERTICES]; 4654 double xyz_list[NUMVERTICES][3]; 4655 double stokesreconditioning; 4656 4657 double *vzmacayeal_ptr = NULL; 4658 Penta *penta = NULL; 4659 4660 /*OK, we have to add results of this element for macayeal 4661 * and results from the penta at base for macayeal. Now recover results*/ 4662 penta=GetBasalElement(); 4663 4664 /*Get dof listof this element (macayeal dofs) and of the penta at base (macayeal dofs): */ 4665 penta->GetDofList(&doflistm,MacAyealApproximationEnum,GsetEnum); 4666 GetDofList(&doflists,StokesApproximationEnum,GsetEnum); 4667 this->parameters->FindParam(&stokesreconditioning,StokesReconditioningEnum); 4668 4669 /*Get node data: */ 4670 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4671 4672 /*Use the dof list to index into the solution vector: */ 4673 for(i=0;i<numdof2d;i++){ 4674 macayeal_values[i]=solution[doflistm[i]]; 4675 macayeal_values[i+numdof2d]=solution[doflistm[i]]; 4676 } 4677 for(i=0;i<numdofs;i++){ 4678 stokes_values[i]=solution[doflists[i]]; 4679 } 4680 4681 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 4682 for(i=0;i<NUMVERTICES;i++){ 4683 vx[i]=stokes_values[i*NDOF4+0]+macayeal_values[i*NDOF2+0]; 4684 vy[i]=stokes_values[i*NDOF4+1]+macayeal_values[i*NDOF2+1]; 4685 vzstokes[i]=stokes_values[i*NDOF4+2]; 4686 pressure[i]=stokes_values[i*NDOF4+3]*stokesreconditioning; 4687 } 4688 4689 /*Get Vz*/ 4690 Input* vzmacayeal_input=inputs->GetInput(VzMacAyealEnum); 4691 if (vzmacayeal_input){ 4692 if (vzmacayeal_input->Enum()!=PentaVertexInputEnum){ 4693 ISSMERROR("Cannot compute Vel as VzMacAyeal is of type %s",EnumToString(vzmacayeal_input->Enum())); 4694 } 4695 vzmacayeal_input->GetValuesPtr(&vzmacayeal_ptr,&dummy); 4696 for(i=0;i<NUMVERTICES;i++) vzmacayeal[i]=vzmacayeal_ptr[i]; 4697 } 4698 else{ 4699 ISSMERROR("Cannot update solution as VzMacAyeal is not present"); 4700 } 4701 4702 /*Now Compute vel*/ 4703 for(i=0;i<NUMVERTICES;i++) { 4704 vz[i]=vzmacayeal[i]+vzstokes[i]; 4705 vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 4706 } 4707 4708 /*Now, we have to move the previous Vx and Vy inputs to old 4709 * status, otherwise, we'll wipe them off: */ 4710 this->inputs->ChangeEnum(VxEnum,VxOldEnum); 4711 this->inputs->ChangeEnum(VyEnum,VyOldEnum); 4712 this->inputs->ChangeEnum(VzEnum,VzOldEnum); 4713 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 4714 4715 /*Add vx and vy as inputs to the tria element: */ 4716 this->inputs->AddInput(new PentaVertexInput(VxEnum,vx)); 4717 this->inputs->AddInput(new PentaVertexInput(VyEnum,vy)); 4718 this->inputs->AddInput(new PentaVertexInput(VzEnum,vz)); 4719 this->inputs->AddInput(new PentaVertexInput(VzStokesEnum,vzstokes)); 4720 this->inputs->AddInput(new PentaVertexInput(VelEnum,vel)); 4721 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 4722 4723 /*Free ressources:*/ 4724 xfree((void**)&doflistm); 4725 xfree((void**)&doflists); 4629 4726 } 4630 4727 /*}}}*/ … … 4889 4986 double vy[NUMVERTICES]; 4890 4987 double vz[NUMVERTICES]; 4988 double vzmacayeal[NUMVERTICES]; 4891 4989 double vzpattyn[NUMVERTICES]; 4892 4990 double vzstokes[NUMVERTICES]; … … 4943 5041 else for(i=0;i<NUMVERTICES;i++) vy[i]=0.0; 4944 5042 4945 /*Do some modifications if we actually have a PattynStokes element*/5043 /*Do some modifications if we actually have a PattynStokes or MacAyealStokes element*/ 4946 5044 if(approximation==PattynStokesApproximationEnum){ 4947 5045 Input* vzstokes_input=inputs->GetInput(VzStokesEnum); … … 4957 5055 } 4958 5056 } 5057 else if(approximation==MacAyealStokesApproximationEnum){ 5058 Input* vzstokes_input=inputs->GetInput(VzStokesEnum); 5059 if (vzstokes_input){ 5060 if (vzstokes_input->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as VzStokes is of type %s",EnumToString(vy_input->Enum())); 5061 vzstokes_input->GetValuesPtr(&vzstokes_ptr,&dummy); 5062 for(i=0;i<NUMVERTICES;i++) vzstokes[i]=vzstokes_ptr[i]; 5063 } 5064 else ISSMERROR("Cannot compute Vz as VzStokes in not present in MacAyealStokes element"); 5065 for(i=0;i<NUMVERTICES;i++){ 5066 vzmacayeal[i]=vz[i]; 5067 vz[i]=vzmacayeal[i]+vzstokes[i]; 5068 } 5069 } 4959 5070 4960 5071 /*Now Compute vel*/ … … 4964 5075 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, 4965 5076 *so the pressure is just the pressure at the z elevation: except it this is a PattynStokes element */ 4966 if(approximation!=PattynStokesApproximationEnum ){5077 if(approximation!=PattynStokesApproximationEnum && approximation!=MacAyealStokesApproximationEnum){ 4967 5078 rho_ice=matpar->GetRhoIce(); 4968 5079 g=matpar->GetG(); … … 4975 5086 this->inputs->ChangeEnum(VzEnum,VzOldEnum); 4976 5087 4977 if(approximation!=PattynStokesApproximationEnum ){5088 if(approximation!=PattynStokesApproximationEnum && approximation!=MacAyealStokesApproximationEnum){ 4978 5089 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 4979 5090 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 4980 5091 } 4981 else {5092 else if(approximation==PattynStokesApproximationEnum){ 4982 5093 this->inputs->AddInput(new PentaVertexInput(VzPattynEnum,vzpattyn)); 5094 } 5095 else if(approximation==MacAyealStokesApproximationEnum){ 5096 this->inputs->AddInput(new PentaVertexInput(VzMacAyealEnum,vzpattyn)); 4983 5097 } 4984 5098 -
issm/trunk/src/c/objects/Elements/Penta.h
r6130 r6150 202 202 void InputUpdateFromSolutionDiagnosticMacAyeal( double* solutiong); 203 203 void InputUpdateFromSolutionDiagnosticMacAyealPattyn( double* solutiong); 204 void InputUpdateFromSolutionDiagnosticMacAyealStokes( double* solutiong); 204 205 void InputUpdateFromSolutionDiagnosticPattyn( double* solutiong); 205 206 void InputUpdateFromSolutionDiagnosticPattynStokes( double* solutiong);
Note:
See TracChangeset
for help on using the changeset viewer.