Changeset 5803
- Timestamp:
- 09/14/10 14:46:19 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r5770 r5803 252 252 VzObsEnum, 253 253 VzOldEnum, 254 VzPattynEnum, 255 VzStokesEnum, 254 256 QmuVzEnum, 255 257 WeightsEnum, -
issm/trunk/src/c/EnumDefinitions/EnumToString.cpp
r5770 r5803 226 226 case VzObsEnum : return "VzObs"; 227 227 case VzOldEnum : return "VzOld"; 228 case VzPattynEnum : return "VzPattyn"; 229 case VzStokesEnum : return "VzStokes"; 228 230 case QmuVzEnum : return "QmuVz"; 229 231 case WeightsEnum : return "Weights"; -
issm/trunk/src/c/EnumDefinitions/StringToEnum.cpp
r5770 r5803 224 224 else if (strcmp(name,"VzObs")==0) return VzObsEnum; 225 225 else if (strcmp(name,"VzOld")==0) return VzOldEnum; 226 else if (strcmp(name,"VzPattyn")==0) return VzPattynEnum; 227 else if (strcmp(name,"VzStokes")==0) return VzStokesEnum; 226 228 else if (strcmp(name,"QmuVz")==0) return QmuVzEnum; 227 229 else if (strcmp(name,"Weights")==0) return WeightsEnum; -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp
r4236 r5803 31 31 /*Fetch data: */ 32 32 IoModelFetchData(&iomodel->spcvelocity,NULL,NULL,iomodel_handle,"spcvelocity"); 33 IoModelFetchData(&iomodel->gridonstokes,NULL,NULL,iomodel_handle,"gridonstokes"); 33 34 34 35 /*Initialize counter*/ … … 41 42 if(iomodel->my_vertices[i]){ 42 43 43 if ((int)iomodel->spcvelocity[6*i+2]){ 44 if ((int)iomodel->gridonstokes[i]){ 45 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,0,DiagnosticVertAnalysisEnum)); //spc to zero as vertical velocity is done in Horiz for Stokes 46 count++; 47 } 48 else if ((int)iomodel->spcvelocity[6*i+2]){ 44 49 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1, 45 50 *(iomodel->spcvelocity+6*i+5)/iomodel->yts,DiagnosticVertAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. … … 52 57 /*Free data: */ 53 58 xfree((void**)&iomodel->spcvelocity); 59 xfree((void**)&iomodel->gridonstokes); 54 60 55 61 cleanup_and_return: -
issm/trunk/src/c/objects/Elements/Penta.cpp
r5785 r5803 367 367 /*Just branch to the correct InputUpdateFromSolution generator, according to the type of analysis we are carrying out: */ 368 368 if (analysis_type==DiagnosticHorizAnalysisEnum){ 369 int approximation; 370 inputs->GetParameterValue(&approximation,ApproximationEnum); 371 if(approximation==StokesApproximationEnum || approximation==NoneApproximationEnum){ 372 InputUpdateFromSolutionDiagnosticStokes( solution); 373 } 374 else{ 375 InputUpdateFromSolutionDiagnosticHoriz( solution); 376 } 369 InputUpdateFromSolutionDiagnosticHoriz( solution); 377 370 } 378 371 else if (analysis_type==DiagnosticHutterAnalysisEnum){ … … 901 894 GetSolutionFromInputsDiagnosticStokes(solution); 902 895 } 903 else {896 else if (approximation==MacAyealApproximationEnum || approximation==PattynApproximationEnum || approximation==HutterApproximationEnum){ 904 897 GetSolutionFromInputsDiagnosticHoriz(solution); 898 } 899 else if (approximation==MacAyealPattynApproximationEnum || approximation==PattynStokesApproximationEnum){ 900 return; //the elements around will create the solution 905 901 } 906 902 } … … 3603 3599 Input* vx_input=inputs->GetInput(VxEnum); ISSMASSERT(vx_input); 3604 3600 Input* vy_input=inputs->GetInput(VyEnum); ISSMASSERT(vy_input); 3605 Input* vz _input=NULL;3601 Input* vzstokes_input=NULL; 3606 3602 if(approximation==PattynStokesApproximationEnum){ 3607 vz _input=inputs->GetInput(VzEnum); ISSMASSERT(vz_input);3603 vzstokes_input=inputs->GetInput(VzStokesEnum); ISSMASSERT(vzstokes_input); 3608 3604 } 3609 3605 … … 3618 3614 vy_input->GetParameterDerivativeValue(&dv[0],&xyz_list[0][0],gauss); 3619 3615 if(approximation==PattynStokesApproximationEnum){ 3620 vz _input->GetParameterDerivativeValue(&dw[0],&xyz_list[0][0],gauss);3616 vzstokes_input->GetParameterDerivativeValue(&dw[0],&xyz_list[0][0],gauss); 3621 3617 dwdz=dw[2]; 3622 3618 } … … 4009 4005 /*If the element is a coupling, do nothing: every grid is also on an other elements 4010 4006 * (as coupling is between MacAyeal and Pattyn) so the other element will take care of it*/ 4011 if(approximation==MacAyealPattynApproximationEnum){ 4012 return; 4013 } 4014 else{ 4015 GetDofList(&doflist,approximation,GsetEnum); 4016 } 4007 GetDofList(&doflist,approximation,GsetEnum); 4017 4008 4018 4009 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4460 4451 else if (approximation==PattynApproximationEnum){ 4461 4452 InputUpdateFromSolutionDiagnosticPattyn(solution); 4453 } 4454 else if (approximation==PattynStokesApproximationEnum){ 4455 InputUpdateFromSolutionDiagnosticPattynStokes(solution); 4456 } 4457 else if (approximation==StokesApproximationEnum || approximation==NoneApproximationEnum){ 4458 InputUpdateFromSolutionDiagnosticStokes(solution); 4462 4459 } 4463 4460 else if (approximation==MacAyealPattynApproximationEnum){ … … 4726 4723 4727 4724 /*}}}*/ 4725 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattynStokes {{{1*/ 4726 void Penta::InputUpdateFromSolutionDiagnosticPattynStokes(double* solution){ 4727 4728 int i; 4729 4730 const int numdofpervertexp=2; 4731 const int numdofpervertexs=4; 4732 const int numdofp=numdofpervertexp*NUMVERTICES; 4733 const int numdofs=numdofpervertexs*NUMVERTICES; 4734 int* doflistp=NULL; 4735 int* doflists=NULL; 4736 double pattyn_values[numdofp]; 4737 double stokes_values[numdofs]; 4738 double vx[NUMVERTICES]; 4739 double vy[NUMVERTICES]; 4740 double vz[NUMVERTICES]; 4741 double vzpattyn[NUMVERTICES]; 4742 double vzstokes[NUMVERTICES]; 4743 double vel[NUMVERTICES]; 4744 int dummy; 4745 double pressure[NUMVERTICES]; 4746 double surface[NUMVERTICES]; 4747 double rho_ice,g; 4748 double xyz_list[NUMVERTICES][3]; 4749 4750 double *vzpattyn_ptr = NULL; 4751 Penta *penta = NULL; 4752 4753 /*OK, we have to add results of this element for pattyn 4754 * and results from the penta at base for macayeal. Now recover results*/ 4755 penta=GetBasalElement(); 4756 4757 /*Get dof listof this element (pattyn dofs) and of the penta at base (macayeal dofs): */ 4758 GetDofList(&doflistp,PattynApproximationEnum,GsetEnum); 4759 GetDofList(&doflists,StokesApproximationEnum,GsetEnum); 4760 4761 /*Get node data: */ 4762 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4763 4764 /*Use the dof list to index into the solution vector: */ 4765 for(i=0;i<numdofp;i++){ 4766 pattyn_values[i]=solution[doflistp[i]]; 4767 } 4768 for(i=0;i<numdofs;i++){ 4769 stokes_values[i]=solution[doflists[i]]; 4770 } 4771 4772 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 4773 for(i=0;i<NUMVERTICES;i++){ 4774 vx[i]=stokes_values[i*numdofpervertexs+0]+pattyn_values[i*numdofpervertexp+0]; 4775 vy[i]=stokes_values[i*numdofpervertexs+1]+pattyn_values[i*numdofpervertexp+1]; 4776 vzstokes[i]=stokes_values[i*numdofpervertexs+2]; 4777 pressure[i]=stokes_values[i*numdofpervertexs+3]; 4778 } 4779 4780 /*Get Vz*/ 4781 Input* vzpattyn_input=inputs->GetInput(VzPattynEnum); 4782 if (vzpattyn_input){ 4783 if (vzpattyn_input->Enum()!=PentaVertexInputEnum){ 4784 ISSMERROR("Cannot compute Vel as VzPattyn is of type %s",EnumToString(vzpattyn_input->Enum())); 4785 } 4786 vzpattyn_input->GetValuesPtr(&vzpattyn_ptr,&dummy); 4787 for(i=0;i<NUMVERTICES;i++) vzpattyn[i]=vzpattyn_ptr[i]; 4788 } 4789 else{ 4790 ISSMERROR("Cannot update solution as VzPattyn is not present"); 4791 } 4792 4793 /*Now Compute vel*/ 4794 for(i=0;i<NUMVERTICES;i++) { 4795 vz[i]=vzpattyn[i]+vzstokes[i]; 4796 vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 4797 } 4798 4799 /*Now, we have to move the previous Vx and Vy inputs to old 4800 * status, otherwise, we'll wipe them off: */ 4801 this->inputs->ChangeEnum(VxEnum,VxOldEnum); 4802 this->inputs->ChangeEnum(VyEnum,VyOldEnum); 4803 this->inputs->ChangeEnum(VzEnum,VzOldEnum); 4804 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 4805 4806 /*Add vx and vy as inputs to the tria element: */ 4807 this->inputs->AddInput(new PentaVertexInput(VxEnum,vx)); 4808 this->inputs->AddInput(new PentaVertexInput(VyEnum,vy)); 4809 this->inputs->AddInput(new PentaVertexInput(VzEnum,vz)); 4810 this->inputs->AddInput(new PentaVertexInput(VzStokesEnum,vzstokes)); 4811 this->inputs->AddInput(new PentaVertexInput(VelEnum,vel)); 4812 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 4813 4814 /*Free ressources:*/ 4815 xfree((void**)&doflistp); 4816 xfree((void**)&doflists); 4817 } 4818 /*}}}*/ 4728 4819 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHutter {{{1*/ 4729 4820 void Penta::InputUpdateFromSolutionDiagnosticHutter(double* solution){ … … 4815 4906 double vy[NUMVERTICES]; 4816 4907 double vz[NUMVERTICES]; 4908 double vzpattyn[NUMVERTICES]; 4909 double vzstokes[NUMVERTICES]; 4817 4910 double vel[NUMVERTICES]; 4818 4911 int dummy; … … 4824 4917 double* vx_ptr=NULL; 4825 4918 double* vy_ptr=NULL; 4919 double* vzstokes_ptr=NULL; 4920 4921 int approximation; 4826 4922 4827 4923 /*Get dof list: */ … … 4830 4926 /*Get node data: */ 4831 4927 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4928 inputs->GetParameterValue(&approximation,ApproximationEnum); 4832 4929 4833 4930 /*Use the dof list to index into the solution vector: */ … … 4858 4955 else for(i=0;i<NUMVERTICES;i++) vy[i]=0.0; 4859 4956 4957 /*Do some modifications if we actually have a PattynStokes element*/ 4958 if(approximation==PattynStokesApproximationEnum){ 4959 Input* vzstokes_input=inputs->GetInput(VzStokesEnum); 4960 if (vzstokes_input){ 4961 if (vzstokes_input->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as VzStokes is of type %s",EnumToString(vy_input->Enum())); 4962 vzstokes_input->GetValuesPtr(&vzstokes_ptr,&dummy); 4963 for(i=0;i<NUMVERTICES;i++) vzstokes[i]=vzstokes_ptr[i]; 4964 } 4965 else ISSMERROR("Cannot compute Vz as VzStokes in not present in PattynStokes element"); 4966 for(i=0;i<NUMVERTICES;i++){ 4967 vzpattyn[i]=vz[i]; 4968 vz[i]=vzpattyn[i]+vzstokes[i]; 4969 } 4970 } 4971 4860 4972 /*Now Compute vel*/ 4973 4861 4974 for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 4862 4975 4863 4976 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, 4864 *so the pressure is just the pressure at the z elevation: */ 4865 rho_ice=matpar->GetRhoIce(); 4866 g=matpar->GetG(); 4867 GetParameterListOnVertices(&surface[0],SurfaceEnum); 4868 for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]); 4977 *so the pressure is just the pressure at the z elevation: except it this is a PattynStokes element */ 4978 if(!approximation==PattynStokesApproximationEnum){ 4979 rho_ice=matpar->GetRhoIce(); 4980 g=matpar->GetG(); 4981 GetParameterListOnVertices(&surface[0],SurfaceEnum); 4982 for(i=0;i<NUMVERTICES;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]); 4983 } 4869 4984 4870 4985 /*Now, we have to move the previous Vz inputs to old 4871 * status, otherwise, we'll wipe them off : */4986 * status, otherwise, we'll wipe them off and add the new inputs: */ 4872 4987 this->inputs->ChangeEnum(VzEnum,VzOldEnum); 4873 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 4874 4875 /*Add vz and vel as inputs to the penta element: */ 4988 4989 if(!approximation==PattynStokesApproximationEnum){ 4990 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 4991 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 4992 } 4993 else{ 4994 this->inputs->AddInput(new PentaVertexInput(VzPattynEnum,vzpattyn)); 4995 } 4996 4876 4997 this->inputs->AddInput(new PentaVertexInput(VzEnum,vz)); 4877 4998 this->inputs->AddInput(new PentaVertexInput(VelEnum,vel)); 4878 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure));4879 4999 4880 5000 /*Free ressources:*/ -
issm/trunk/src/c/objects/Elements/Tria.cpp
r5785 r5803 4152 4152 Input* vx_input=inputs->GetInput(VxEnum); ISSMASSERT(vx_input); 4153 4153 Input* vy_input=inputs->GetInput(VyEnum); ISSMASSERT(vy_input); 4154 Input* vz _input=NULL;4154 Input* vzstokes_input=NULL; 4155 4155 if(approximation==PattynStokesApproximationEnum){ 4156 vz _input=inputs->GetInput(VzEnum); ISSMASSERT(vz_input);4156 vzstokes_input=inputs->GetInput(VzStokesEnum); ISSMASSERT(vzstokes_input); 4157 4157 } 4158 4158 Input* bed_input=inputs->GetInput(BedEnum); ISSMASSERT(bed_input); … … 4172 4172 vy_input->GetParameterValue(&vy, gauss); 4173 4173 if(approximation==PattynStokesApproximationEnum){ 4174 vz _input->GetParameterValue(&vz, gauss);4174 vzstokes_input->GetParameterValue(&vz, gauss); 4175 4175 } 4176 4176 else vz=0;
Note:
See TracChangeset
for help on using the changeset viewer.