Changeset 6320
- Timestamp:
- 10/15/10 11:55:16 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r6271 r6320 652 652 void Penta::ComputeBasalStress(Vec sigma_b){ 653 653 654 int i,j; 655 int doflist[NUMVERTICES]; 656 double xyz_list[NUMVERTICES][3]; 657 double xyz_list_tria[3][3]; 658 659 /*Parameters*/ 660 double rho_ice,gravity; 661 double bed_normal[3]; 662 double bed; 663 double basalforce[3]; 664 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 665 double devstresstensor[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 666 double stresstensor[6]={0.0}; 667 double viscosity; 668 int analysis_type; 669 670 int dofv[3]={0,1,2}; 671 int dofp[1]={3}; 672 double Jdet2d; 673 674 /*Gauss*/ 675 int ig; 654 int i,j,ig; 655 int dofv[3]={0,1,2}; 656 int dofp[1]={3}; 657 int analysis_type,approximation; 658 int doflist[NUMVERTICES]; 659 double xyz_list[NUMVERTICES][3]; 660 double xyz_list_tria[3][3]; 661 double rho_ice,gravity,stokesreconditioning; 662 double pressure,viscosity,bed,Jdet2d; 663 double bed_normal[3]; 664 double basalforce[3]; 665 double epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 666 double devstresstensor[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/ 667 double stresstensor[6]={0.0}; 668 double sigma_xx,sigma_yy,sigma_zz; 669 double sigma_xy,sigma_xz,sigma_yz; 670 double surface=0,value=0; 676 671 GaussPenta* gauss; 677 678 /*Output*/679 double pressure;680 double sigma_xx,sigma_yy,sigma_zz;681 double sigma_xy,sigma_xz,sigma_yz;682 double surface=0;683 double value=0;684 685 /*flags: */686 int approximation;687 688 /*parameters: */689 double stokesreconditioning;690 672 691 673 /*retrive parameters: */ … … 712 694 /* Get node coordinates and dof list: */ 713 695 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 714 for(i=0;i<3;i++){ 715 for(j=0;j<3;j++){ 716 xyz_list_tria[i][j]=xyz_list[i][j]; 717 } 718 } 696 for(i=0;i<3;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i][j]; 719 697 720 698 /*Retrieve all inputs we will be needing: */ … … 1114 1092 1115 1093 int i; 1094 bool converged=true; 1116 1095 Input** new_inputs=NULL; 1117 1096 Input** old_inputs=NULL; 1118 bool converged=true;1119 1097 1120 1098 new_inputs=(Input**)xmalloc(num_enums/2*sizeof(Input*)); //half the enums are for the new inputs … … 1140 1118 /*Return output*/ 1141 1119 return converged; 1142 1143 1120 } 1144 1121 /*}}}*/ … … 1189 1166 void Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum){ 1190 1167 1191 /*Intermediaries*/1192 1168 int step,i; 1193 1169 double xyz_list[NUMVERTICES][3]; 1170 double Helem_list[NUMVERTICES]; 1171 double zeros_list[NUMVERTICES]={0.0}; 1194 1172 Penta* penta=NULL; 1195 1173 Input* original_input=NULL; … … 1199 1177 Input* total_thickness_input=NULL; 1200 1178 Input* depth_averaged_input=NULL; 1201 1202 double xyz_list[NUMVERTICES][3];1203 double Helem_list[NUMVERTICES];1204 double zeros_list[NUMVERTICES]={0.0};1205 1179 1206 1180 /*recover parameters: */ … … 1408 1382 /*Assign output pointers:*/ 1409 1383 *pmaxvx=maxvx; 1410 1411 1384 } 1412 1385 /*}}}*/ … … 1422 1395 /*Assign output pointers:*/ 1423 1396 *pmaxvy=maxvy; 1424 1425 1397 } 1426 1398 /*}}}*/ … … 1436 1408 /*Assign output pointers:*/ 1437 1409 *pmaxvz=maxvz; 1438 1439 1410 } 1440 1411 /*}}}*/ … … 1450 1421 /*Assign output pointers:*/ 1451 1422 *pminvel=minvel; 1452 1453 1423 } 1454 1424 /*}}}*/ … … 1464 1434 /*Assign output pointers:*/ 1465 1435 *pminvx=minvx; 1466 1467 1436 } 1468 1437 /*}}}*/ … … 1478 1447 /*Assign output pointers:*/ 1479 1448 *pminvy=minvy; 1480 1481 1449 } 1482 1450 /*}}}*/ … … 1492 1460 /*Assign output pointers:*/ 1493 1461 *pminvz=minvz; 1494 1495 1462 } 1496 1463 /*}}}*/ … … 1498 1465 double Penta::TimeAdapt(void){ 1499 1466 1500 /*intermediary: */ 1501 double C; 1502 double maxabsvx; 1503 double maxabsvy; 1504 double maxabsvz; 1505 double maxx,minx; 1506 double maxy,miny; 1507 double maxz,minz; 1508 double dx,dy,dz; 1467 int i; 1468 double C,dx,dy,dz,dt; 1469 double maxabsvx,maxabsvy,maxabsvz; 1470 double maxx,minx,maxy,miny,maxz,minz; 1509 1471 double xyz_list[NUMVERTICES][3]; 1510 int i;1511 1512 /*output: */1513 double dt;1514 1472 1515 1473 /*get CFL coefficient:*/ … … 1547 1505 1548 1506 return dt; 1549 1550 1507 } 1551 1508 /*FUNCTION Penta::ThicknessAbsMisfit {{{1*/ 1552 1509 double Penta::ThicknessAbsMisfit(bool process_units){ 1553 1510 1511 int approximation; 1554 1512 double J; 1555 Tria* tria=NULL; 1556 1557 /*inputs: */ 1558 int approximation; 1513 Tria* tria=NULL; 1559 1514 1560 1515 /*retrieve inputs :*/ … … 1574 1529 double Penta::SurfaceAbsVelMisfit(bool process_units){ 1575 1530 1531 int approximation; 1576 1532 double J; 1577 Tria* tria=NULL; 1578 1579 /*inputs: */ 1580 int approximation; 1533 Tria* tria=NULL; 1581 1534 1582 1535 /*retrieve inputs :*/ … … 1613 1566 double Penta::SurfaceRelVelMisfit(bool process_units){ 1614 1567 1568 int approximation; 1615 1569 double J; 1616 Tria* tria=NULL; 1617 1618 /*inputs: */ 1619 int approximation; 1570 Tria* tria=NULL; 1620 1571 1621 1572 /*retrieve inputs :*/ … … 1652 1603 double Penta::SurfaceLogVelMisfit(bool process_units){ 1653 1604 1605 int approximation; 1654 1606 double J; 1655 Tria* tria=NULL; 1656 1657 /*inputs: */ 1658 int approximation; 1607 Tria* tria=NULL; 1659 1608 1660 1609 /*retrieve inputs :*/ … … 1730 1679 double Penta::SurfaceAverageVelMisfit(bool process_units){ 1731 1680 1681 int approximation; 1732 1682 double J; 1733 Tria* tria=NULL; 1734 1735 /*inputs: */ 1736 int approximation; 1683 Tria* tria=NULL; 1737 1684 1738 1685 /*retrieve inputs :*/ … … 1769 1716 void Penta::PatchFill(int* pcount, Patch* patch){ 1770 1717 1771 int i; 1772 int count; 1718 int i,count; 1773 1719 int vertices_ids[6]; 1774 1775 1720 1776 1721 /*recover pointer: */ … … 1799 1744 1800 1745 int i; 1801 1802 /*output: */ 1803 int numrows = 0; 1804 int numnodes = 0; 1746 int numrows = 0; 1747 int numnodes = 0; 1805 1748 1806 1749 /*Go through all the results objects, and update the counters: */ … … 1817 1760 *pnumvertices=NUMVERTICES; 1818 1761 *pnumnodes=numnodes; 1819 1820 1762 } 1821 1763 /*}}}*/ … … 1829 1771 elementresult->ProcessUnits(this->parameters); 1830 1772 } 1831 1832 1773 } 1833 1774 /*}}}*/ … … 1851 1792 double Penta::SurfaceArea(void){ 1852 1793 1794 int approximation; 1853 1795 double S; 1854 Tria* tria=NULL; 1855 1856 /*inputs: */ 1857 int approximation; 1796 Tria* tria=NULL; 1858 1797 1859 1798 /*retrieve inputs :*/ … … 1914 1853 1915 1854 /*Recover vertices ids needed to initialize inputs*/ 1916 for(i=0;i<6;i++){ 1917 penta_vertex_ids[i]=(int)iomodel->elements[6*index+i]; //ids for vertices are in the elements array from Matlab 1918 } 1855 for(i=0;i<6;i++) penta_vertex_ids[i]=(int)iomodel->elements[6*index+i]; //ids for vertices are in the elements array from Matlab 1919 1856 1920 1857 /*Recover nodes ids needed to initialize the node hook.*/ … … 2003 1940 break; 2004 1941 } 2005 2006 1942 } 2007 1943 /*}}}*/ … … 2010 1946 2011 1947 /*Intermediaries*/ 2012 int i;1948 int i; 2013 1949 double rho_ice,rho_water; 2014 1950 … … 2039 1975 this->inputs->AXPY(SurfaceEnum,1.0,ThicknessEnum); //2: surface = surface + 1 * thickness 2040 1976 } 2041 2042 1977 } 2043 1978 /*}}}*/ … … 2048 1983 2049 1984 int i; 2050 double v13[3]; 2051 double v23[3]; 1985 double v13[3],v23[3]; 2052 1986 double normal[3]; 2053 1987 double normal_norm; … … 2061 1995 normal[1]=v13[2]*v23[0]-v13[0]*v23[2]; 2062 1996 normal[2]=v13[0]*v23[1]-v13[1]*v23[0]; 2063 2064 1997 normal_norm=sqrt( pow(normal[0],2)+pow(normal[1],2)+pow(normal[2],2) ); 2065 1998 … … 2068 2001 *(bed_normal+1)=-normal[1]/normal_norm; 2069 2002 *(bed_normal+2)=-normal[2]/normal_norm; 2070 2071 2003 } 2072 2004 /*}}}*/ … … 3939 3871 void Penta::GetDofList(int** pdoflist,int approximation_enum,int setenum){ 3940 3872 3941 int i,j; 3942 int numberofdofs=0; 3943 int count=0; 3944 3945 /*output: */ 3873 int i,j,count=0; 3874 int numberofdofs=0; 3946 3875 int* doflist=NULL; 3947 3876 3948 3877 /*First, figure out size of doflist: */ 3949 for(i=0;i<6;i++){ 3950 numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 3951 } 3878 for(i=0;i<6;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 3952 3879 3953 3880 /*Allocate: */ … … 3963 3890 /*Assign output pointers:*/ 3964 3891 *pdoflist=doflist; 3965 3966 3892 } 3967 3893 /*}}}*/ … … 3970 3896 3971 3897 int i; 3972 3973 for(i=0;i<6;i++){ 3974 doflist[i]=nodes[i]->GetDofList1(); 3975 } 3898 for(i=0;i<6;i++) doflist[i]=nodes[i]->GetDofList1(); 3976 3899 3977 3900 } … … 3990 3913 /*return PentaRef field*/ 3991 3914 return this->element_type; 3992 3993 3915 } 3994 3916 /*}}}*/ … … 4101 4023 void Penta::GetSolutionFromInputsDiagnosticHoriz(Vec solution){ 4102 4024 4103 int i; 4104 4105 const int numdofpervertex=2; 4106 const int numdof=numdofpervertex*NUMVERTICES; 4025 const int numdof=NDOF2*NUMVERTICES; 4026 4027 int i; 4028 int approximation; 4029 int* doflist=NULL; 4030 double vx,vy; 4031 double values[numdof]; 4107 4032 GaussPenta* gauss; 4108 int* doflist=NULL;4109 double values[numdof];4110 double vx;4111 double vy;4112 int approximation;4113 4033 4114 4034 /*Get approximation enum and dof list: */ … … 4130 4050 vx_input->GetParameterValue(&vx,gauss); 4131 4051 vy_input->GetParameterValue(&vy,gauss); 4132 values[i* numdofpervertex+0]=vx;4133 values[i* numdofpervertex+1]=vy;4052 values[i*NDOF2+0]=vx; 4053 values[i*NDOF2+1]=vy; 4134 4054 } 4135 4055 … … 4145 4065 void Penta::GetSolutionFromInputsDiagnosticHutter(Vec solution){ 4146 4066 4147 int i; 4148 4149 const int numdofpervertex=2; 4150 const int numdof=numdofpervertex*NUMVERTICES; 4067 const int numdof=NDOF2*NUMVERTICES; 4068 4069 int i; 4070 int* doflist=NULL; 4071 double vx,vy; 4072 double values[numdof]; 4151 4073 GaussPenta* gauss=NULL; 4152 int* doflist=NULL;4153 double values[numdof];4154 double vx;4155 double vy;4156 4074 4157 4075 /*Get dof list: */ … … 4164 4082 gauss=new GaussPenta(); 4165 4083 for(i=0;i<NUMVERTICES;i++){ 4166 4167 4084 /*Recover vx and vy*/ 4168 4085 gauss->GaussVertex(i); 4169 4086 vx_input->GetParameterValue(&vx,gauss); 4170 4087 vy_input->GetParameterValue(&vy,gauss); 4171 values[i* numdofpervertex+0]=vx;4172 values[i* numdofpervertex+1]=vy;4088 values[i*NDOF2+0]=vx; 4089 values[i*NDOF2+1]=vy; 4173 4090 } 4174 4091 … … 4184 4101 void Penta::GetSolutionFromInputsDiagnosticVert(Vec solution){ 4185 4102 4186 int i; 4187 4188 const int numdofpervertex=1; 4189 const int numdof=numdofpervertex*NUMVERTICES; 4103 const int numdof=NDOF1*NUMVERTICES; 4104 4105 int i; 4106 int* doflist=NULL; 4107 double vz; 4108 double values[numdof]; 4190 4109 GaussPenta* gauss=NULL; 4191 int* doflist=NULL;4192 double values[numdof];4193 double vz;4194 4110 4195 4111 /*Get dof list: */ … … 4201 4117 gauss=new GaussPenta(); 4202 4118 for(i=0;i<NUMVERTICES;i++){ 4203 4204 4119 /*Recover vz */ 4205 4120 gauss->GaussVertex(i); … … 4219 4134 void Penta::GetSolutionFromInputsDiagnosticStokes(Vec solution){ 4220 4135 4221 int i; 4222 4223 const int numdofpervertex=4; 4224 const int numdof=numdofpervertex*NUMVERTICES; 4225 GaussPenta *gauss; 4136 const int numdof=NDOF4*NUMVERTICES; 4137 4138 int i; 4226 4139 int* doflist=NULL; 4227 double values[numdof];4228 4140 double vx,vy,vz,p; 4229 4141 double stokesreconditioning; 4142 double values[numdof]; 4143 GaussPenta *gauss; 4230 4144 4231 4145 /*Get dof list: */ … … 4248 4162 vz_input->GetParameterValue(&vz,gauss); 4249 4163 p_input ->GetParameterValue(&p ,gauss); 4250 values[i* numdofpervertex+0]=vx;4251 values[i* numdofpervertex+1]=vy;4252 values[i* numdofpervertex+2]=vz;4253 values[i* numdofpervertex+3]=p/stokesreconditioning;4164 values[i*NDOF4+0]=vx; 4165 values[i*NDOF4+1]=vy; 4166 values[i*NDOF4+2]=vz; 4167 values[i*NDOF4+3]=p/stokesreconditioning; 4254 4168 } 4255 4169 … … 4265 4179 void Penta::GetSolutionFromInputsThermal(Vec solution){ 4266 4180 4267 int i; 4268 4269 const int numdofpervertex=1; 4270 const int numdof=numdofpervertex*NUMVERTICES; 4271 GaussPenta *gauss=NULL; 4181 const int numdof=NDOF1*NUMVERTICES; 4182 4183 int i; 4272 4184 int* doflist=NULL; 4273 4185 double values[numdof]; 4274 4186 double temp; 4275 4187 GaussPenta *gauss=NULL; 4276 4188 4277 4189 /*Get dof list: */ … … 4279 4191 Input* t_input=inputs->GetInput(TemperatureEnum); ISSMASSERT(t_input); 4280 4192 4281 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */4282 /*P1 element only for now*/4283 4193 gauss=new GaussPenta(); 4284 4194 for(i=0;i<NUMVERTICES;i++){ 4285 4286 /*Recover vz */ 4195 /*Recover temperature*/ 4287 4196 gauss->GaussVertex(i); 4288 4197 t_input->GetParameterValue(&temp,gauss); … … 4327 4236 4328 4237 int i; 4329 4330 4238 double epsilonvx[5]; 4331 4239 double epsilonvy[5]; … … 4342 4250 /*Sum all contributions*/ 4343 4251 for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]; 4344 4345 4252 } 4346 4253 /*}}}*/ … … 4353 4260 4354 4261 int i; 4355 4356 4262 double epsilonvx[6]; 4357 4263 double epsilonvy[6]; … … 4370 4276 /*Sum all contributions*/ 4371 4277 for(i=0;i<6;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]+epsilonvz[i]; 4372 4373 4278 } 4374 4279 /*}}}*/ … … 4382 4287 penta=this; 4383 4288 for(;;){ 4384 4385 4289 /*Stop if we have reached the surface, else, take lower penta*/ 4386 4290 if (penta->IsOnBed()) break; … … 4399 4303 4400 4304 Penta* upper_penta=NULL; 4305 4401 4306 upper_penta=(Penta*)neighbors[0]; //first one (0) under, second one (1) above 4307 4402 4308 return upper_penta; 4403 4404 4309 } 4405 4310 /*}}}*/ … … 4408 4313 4409 4314 Penta* upper_penta=NULL; 4315 4410 4316 upper_penta=(Penta*)neighbors[1]; //first one under, second one above 4317 4411 4318 return upper_penta; 4412 4413 4319 } 4414 4320 /*}}}*/ … … 4417 4323 4418 4324 int i; 4325 double z; 4419 4326 double xyz_list[NUMVERTICES][3]; 4420 4327 double z_list[NUMVERTICES]; 4421 double z;4422 4328 4423 4329 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 4424 for(i=0;i<NUMVERTICES;i++){ 4425 z_list[i]=xyz_list[i][2]; 4426 } 4330 for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][2]; 4427 4331 PentaRef::GetParameterValue(&z,z_list,gauss); 4428 4332 … … 4433 4337 void Penta::GradjB(Vec gradient){ 4434 4338 4435 int i; 4436 Tria* tria=NULL; 4339 int i; 4340 int approximation; 4341 Tria* tria =NULL; 4437 4342 TriaVertexInput* triavertexinput=NULL; 4438 4439 /*retrieve inputs :*/4440 int approximation;4441 inputs->GetParameterValue(&approximation,ApproximationEnum);4442 4343 4443 4344 /*If on water, skip: */ 4444 4345 if(IsOnWater())return; 4346 inputs->GetParameterValue(&approximation,ApproximationEnum); 4445 4347 4446 4348 if (approximation==MacAyealApproximationEnum){ … … 4476 4378 this->matice->inputs->DeleteInput(RheologyBbarEnum); 4477 4379 } 4478 4479 4380 } 4480 4381 /*}}}*/ … … 4482 4383 void Penta::GradjDrag(Vec gradient){ 4483 4384 4484 int i; 4485 Tria* tria=NULL; 4385 int i,approximation; 4386 double temp_gradient[6]={0,0,0,0,0,0}; 4387 Tria* tria=NULL; 4486 4388 TriaVertexInput* triavertexinput=NULL; 4487 double temp_gradient[6]={0,0,0,0,0,0};4488 4389 4489 4390 /*retrieve inputs :*/ 4490 int approximation;4491 4391 inputs->GetParameterValue(&approximation,ApproximationEnum); 4492 4392 4493 /*If on water, skip: */ 4494 if(IsOnWater())return; 4495 4496 /*If on shelf, skip: */ 4497 if(IsOnShelf())return; 4498 4499 /*Bail out if this element does not touch the bedrock: */ 4500 if (!IsOnBed()) return; 4393 /*If on water, on shelf or not on bed, skip: */ 4394 if(IsOnWater()|| IsOnShelf() || !IsOnBed())return; 4501 4395 4502 4396 if (approximation==MacAyealApproximationEnum || approximation==PattynApproximationEnum){ 4503 4504 4397 /*MacAyeal or Pattyn*/ 4505 4398 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. … … 4508 4401 } 4509 4402 else if (approximation==StokesApproximationEnum){ 4510 4511 4403 /*Stokes*/ 4512 4404 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. … … 4518 4410 } 4519 4411 else ISSMERROR("approximation %s not supported yet",EnumToString(approximation)); 4520 4521 4522 4412 } 4523 4413 /*}}}*/ … … 4530 4420 /*Are we on the base, not on the surface?:*/ 4531 4421 if(IsOnBed()){ 4532 4533 4422 /*OK, we are on bed. we will follow the steps: 4534 4423 * 1: find input and extrude it. … … 4569 4458 /*Stop if we have reached the surface*/ 4570 4459 if (penta->IsOnSurface()) break; 4571 4572 4460 } 4573 4461 } … … 4579 4467 void Penta::InputUpdateFromSolutionDiagnosticHoriz(double* solution){ 4580 4468 4581 /*Inputs*/4582 4469 int approximation; 4583 4470 … … 4612 4499 } 4613 4500 } 4614 4615 4501 /*}}}*/ 4616 4502 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticMacAyeal {{{1*/ 4617 4503 void Penta::InputUpdateFromSolutionDiagnosticMacAyeal(double* solution){ 4618 4504 4619 int i; 4620 4621 const int numdofpervertex=2; 4622 const int numdof=numdofpervertex*NUMVERTICES; 4623 int* doflist=NULL; 4624 double values[numdof]; 4625 double vx[NUMVERTICES]; 4626 double vy[NUMVERTICES]; 4627 double vz[NUMVERTICES]; 4628 double vel[NUMVERTICES]; 4629 int dummy; 4630 double pressure[NUMVERTICES]; 4631 double surface[NUMVERTICES]; 4632 double rho_ice,g; 4633 double xyz_list[NUMVERTICES][3]; 4634 4635 double *vz_ptr = NULL; 4636 Penta *penta = NULL; 4637 4638 /*OK, we are on bed. Now recover results*/ 4505 const int numdof=NDOF2*NUMVERTICES; 4506 4507 int i,dummy; 4508 double rho_ice,g; 4509 double values[numdof]; 4510 double vx[NUMVERTICES]; 4511 double vy[NUMVERTICES]; 4512 double vz[NUMVERTICES]; 4513 double vel[NUMVERTICES]; 4514 double pressure[NUMVERTICES]; 4515 double surface[NUMVERTICES]; 4516 double xyz_list[NUMVERTICES][3]; 4517 int *doflist = NULL; 4518 double *vz_ptr = NULL; 4519 Penta *penta = NULL; 4639 4520 4640 4521 /*Get dof list: */ … … 4642 4523 4643 4524 /*Use the dof list to index into the solution vector: */ 4644 for(i=0;i<numdof;i++){ 4645 values[i]=solution[doflist[i]]; 4646 } 4525 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 4647 4526 4648 4527 /*Ok, we have vx and vy in values, fill in vx and vy arrays and extrude */ 4649 4528 for(i=0;i<3;i++){ 4650 vx[i] =values[i* numdofpervertex+0];4651 vy[i] =values[i* numdofpervertex+1];4529 vx[i] =values[i*NDOF2+0]; 4530 vy[i] =values[i*NDOF2+1]; 4652 4531 vx[i+3]=vx[i]; 4653 4532 vy[i+3]=vy[i]; … … 4705 4584 void Penta::InputUpdateFromSolutionDiagnosticMacAyealPattyn(double* solution){ 4706 4585 4707 int i; 4708 4709 const int numdofpervertex=2; 4710 const int numdof=numdofpervertex*NUMVERTICES; 4711 const int numdof2d=numdofpervertex*NUMVERTICES2D; 4712 int* doflistp=NULL; 4713 int* doflistm=NULL; 4714 double macayeal_values[numdof]; 4715 double pattyn_values[numdof]; 4716 double vx[NUMVERTICES]; 4717 double vy[NUMVERTICES]; 4718 double vz[NUMVERTICES]; 4719 double vel[NUMVERTICES]; 4720 int dummy; 4721 double pressure[NUMVERTICES]; 4722 double surface[NUMVERTICES]; 4723 double rho_ice,g; 4724 double xyz_list[NUMVERTICES][3]; 4725 4726 double *vz_ptr = NULL; 4727 Penta *penta = NULL; 4586 const int numdof=NDOF2*NUMVERTICES; 4587 const int numdof2d=NDOF2*NUMVERTICES2D; 4588 4589 int i,dummy; 4590 double rho_ice,g; 4591 double macayeal_values[numdof]; 4592 double pattyn_values[numdof]; 4593 double vx[NUMVERTICES]; 4594 double vy[NUMVERTICES]; 4595 double vz[NUMVERTICES]; 4596 double vel[NUMVERTICES]; 4597 double pressure[NUMVERTICES]; 4598 double surface[NUMVERTICES]; 4599 double xyz_list[NUMVERTICES][3]; 4600 int* doflistp = NULL; 4601 int* doflistm = NULL; 4602 double *vz_ptr = NULL; 4603 Penta *penta = NULL; 4728 4604 4729 4605 /*OK, we have to add results of this element for pattyn … … 4750 4626 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 4751 4627 for(i=0;i<NUMVERTICES;i++){ 4752 vx[i]=macayeal_values[i* numdofpervertex+0]+pattyn_values[i*numdofpervertex+0];4753 vy[i]=macayeal_values[i* numdofpervertex+1]+pattyn_values[i*numdofpervertex+1];4628 vx[i]=macayeal_values[i*NDOF2+0]+pattyn_values[i*NDOF2+0]; 4629 vy[i]=macayeal_values[i*NDOF2+1]+pattyn_values[i*NDOF2+1]; 4754 4630 } 4755 4631 … … 4768 4644 4769 4645 /*Now Compute vel*/ 4770 for(i=0;i<NUMVERTICES;i++) { 4771 vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5); 4772 } 4646 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); 4773 4647 4774 4648 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, … … 4799 4673 void Penta::InputUpdateFromSolutionDiagnosticMacAyealStokes(double* solution){ 4800 4674 4801 int i;4802 4803 4675 const int numdofm=NDOF2*NUMVERTICES; 4804 4676 const int numdofs=NDOF4*NUMVERTICES; 4805 4677 const int numdof2d=NDOF2*NUMVERTICES2D; 4806 int* doflistm=NULL; 4807 int * doflists=NULL;4808 double macayeal_values[numdofm];4809 double stokes_values[numdofs];4810 double vx[NUMVERTICES];4811 double vy[NUMVERTICES];4812 double vz[NUMVERTICES];4813 double vzmacayeal[NUMVERTICES];4814 double vzstokes[NUMVERTICES];4815 double vel[NUMVERTICES];4816 int dummy;4817 double 4818 double 4819 double stokesreconditioning;4820 4821 double *vzmacayeal_ptr= NULL;4822 Penta *penta = NULL;4678 4679 int i,dummy; 4680 double stokesreconditioning; 4681 double macayeal_values[numdofm]; 4682 double stokes_values[numdofs]; 4683 double vx[NUMVERTICES]; 4684 double vy[NUMVERTICES]; 4685 double vz[NUMVERTICES]; 4686 double vzmacayeal[NUMVERTICES]; 4687 double vzstokes[NUMVERTICES]; 4688 double vel[NUMVERTICES]; 4689 double pressure[NUMVERTICES]; 4690 double xyz_list[NUMVERTICES][3]; 4691 int* doflistm = NULL; 4692 int* doflists = NULL; 4693 double *vzmacayeal_ptr = NULL; 4694 Penta *penta = NULL; 4823 4695 4824 4696 /*OK, we have to add results of this element for macayeal … … 4893 4765 void Penta::InputUpdateFromSolutionDiagnosticPattyn(double* solution){ 4894 4766 4895 int i; 4896 4897 const int numdofpervertex=2; 4898 const int numdof=numdofpervertex*NUMVERTICES; 4899 int* doflist=NULL; 4900 double values[numdof]; 4901 double vx[NUMVERTICES]; 4902 double vy[NUMVERTICES]; 4903 double vz[NUMVERTICES]; 4904 double vel[NUMVERTICES]; 4905 int dummy; 4906 double pressure[NUMVERTICES]; 4907 double surface[NUMVERTICES]; 4908 double rho_ice,g; 4909 double xyz_list[NUMVERTICES][3]; 4910 double *vz_ptr = NULL; 4767 const int numdof=NDOF2*NUMVERTICES; 4768 4769 int i,dummy; 4770 double rho_ice,g; 4771 double values[numdof]; 4772 double vx[NUMVERTICES]; 4773 double vy[NUMVERTICES]; 4774 double vz[NUMVERTICES]; 4775 double vel[NUMVERTICES]; 4776 double pressure[NUMVERTICES]; 4777 double surface[NUMVERTICES]; 4778 double xyz_list[NUMVERTICES][3]; 4779 int* doflist = NULL; 4780 double *vz_ptr = NULL; 4911 4781 4912 4782 /*Get dof list: */ … … 4917 4787 4918 4788 /*Use the dof list to index into the solution vector: */ 4919 for(i=0;i<numdof;i++){ 4920 values[i]=solution[doflist[i]]; 4921 } 4789 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 4922 4790 4923 4791 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 4924 4792 for(i=0;i<NUMVERTICES;i++){ 4925 vx[i]=values[i* numdofpervertex+0];4926 vy[i]=values[i* numdofpervertex+1];4793 vx[i]=values[i*NDOF2+0]; 4794 vy[i]=values[i*NDOF2+1]; 4927 4795 } 4928 4796 … … 4965 4833 xfree((void**)&doflist); 4966 4834 } 4967 4968 4835 /*}}}*/ 4969 4836 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattynStokes {{{1*/ 4970 4837 void Penta::InputUpdateFromSolutionDiagnosticPattynStokes(double* solution){ 4971 4838 4972 int i; 4973 4974 const int numdofpervertexp=2; 4975 const int numdofpervertexs=4; 4976 const int numdofp=numdofpervertexp*NUMVERTICES; 4977 const int numdofs=numdofpervertexs*NUMVERTICES; 4978 int* doflistp=NULL; 4979 int* doflists=NULL; 4980 double pattyn_values[numdofp]; 4981 double stokes_values[numdofs]; 4982 double vx[NUMVERTICES]; 4983 double vy[NUMVERTICES]; 4984 double vz[NUMVERTICES]; 4985 double vzpattyn[NUMVERTICES]; 4986 double vzstokes[NUMVERTICES]; 4987 double vel[NUMVERTICES]; 4988 int dummy; 4989 double pressure[NUMVERTICES]; 4990 double xyz_list[NUMVERTICES][3]; 4991 double stokesreconditioning; 4992 4993 double *vzpattyn_ptr = NULL; 4994 Penta *penta = NULL; 4839 const int numdofp=NDOF2*NUMVERTICES; 4840 const int numdofs=NDOF4*NUMVERTICES; 4841 4842 int i,dummy; 4843 double pattyn_values[numdofp]; 4844 double stokes_values[numdofs]; 4845 double vx[NUMVERTICES]; 4846 double vy[NUMVERTICES]; 4847 double vz[NUMVERTICES]; 4848 double vzpattyn[NUMVERTICES]; 4849 double vzstokes[NUMVERTICES]; 4850 double vel[NUMVERTICES]; 4851 double pressure[NUMVERTICES]; 4852 double xyz_list[NUMVERTICES][3]; 4853 double stokesreconditioning; 4854 int* doflistp = NULL; 4855 int* doflists = NULL; 4856 double *vzpattyn_ptr = NULL; 4857 Penta *penta = NULL; 4995 4858 4996 4859 /*OK, we have to add results of this element for pattyn … … 5007 4870 5008 4871 /*Use the dof list to index into the solution vector: */ 5009 for(i=0;i<numdofp;i++){ 5010 pattyn_values[i]=solution[doflistp[i]]; 5011 } 5012 for(i=0;i<numdofs;i++){ 5013 stokes_values[i]=solution[doflists[i]]; 5014 } 4872 for(i=0;i<numdofp;i++) pattyn_values[i]=solution[doflistp[i]]; 4873 for(i=0;i<numdofs;i++) stokes_values[i]=solution[doflists[i]]; 5015 4874 5016 4875 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5017 4876 for(i=0;i<NUMVERTICES;i++){ 5018 vx[i]=stokes_values[i* numdofpervertexs+0]+pattyn_values[i*numdofpervertexp+0];5019 vy[i]=stokes_values[i* numdofpervertexs+1]+pattyn_values[i*numdofpervertexp+1];5020 vzstokes[i]=stokes_values[i* numdofpervertexs+2];5021 pressure[i]=stokes_values[i* numdofpervertexs+3]*stokesreconditioning;4877 vx[i]=stokes_values[i*NDOF4+0]+pattyn_values[i*NDOF2+0]; 4878 vy[i]=stokes_values[i*NDOF4+1]+pattyn_values[i*NDOF2+1]; 4879 vzstokes[i]=stokes_values[i*NDOF4+2]; 4880 pressure[i]=stokes_values[i*NDOF4+3]*stokesreconditioning; 5022 4881 } 5023 4882 … … 5064 4923 void Penta::InputUpdateFromSolutionDiagnosticHutter(double* solution){ 5065 4924 5066 int i; 5067 5068 const int numdofpervertex=2; 5069 const int numdof=numdofpervertex*NUMVERTICES; 5070 int* doflist=NULL; 5071 double values[numdof]; 5072 double vx[NUMVERTICES]; 5073 double vy[NUMVERTICES]; 5074 double vz[NUMVERTICES]; 5075 double vel[NUMVERTICES]; 5076 int dummy; 5077 double pressure[NUMVERTICES]; 5078 double surface[NUMVERTICES]; 5079 double rho_ice,g; 5080 double xyz_list[NUMVERTICES][3]; 5081 double* vz_ptr=NULL; 4925 const int numdof=NDOF2*NUMVERTICES; 4926 4927 int i,dummy; 4928 double rho_ice,g; 4929 double values[numdof]; 4930 double vx[NUMVERTICES]; 4931 double vy[NUMVERTICES]; 4932 double vz[NUMVERTICES]; 4933 double vel[NUMVERTICES]; 4934 double pressure[NUMVERTICES]; 4935 double surface[NUMVERTICES]; 4936 double xyz_list[NUMVERTICES][3]; 4937 int* doflist = NULL; 4938 double* vz_ptr = NULL; 5082 4939 5083 4940 /*Get dof list: */ … … 5088 4945 5089 4946 /*Use the dof list to index into the solution vector: */ 5090 for(i=0;i<numdof;i++){ 5091 values[i]=solution[doflist[i]]; 5092 } 4947 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 5093 4948 5094 4949 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5095 4950 for(i=0;i<NUMVERTICES;i++){ 5096 vx[i]=values[i* numdofpervertex+0];5097 vy[i]=values[i* numdofpervertex+1];4951 vx[i]=values[i*NDOF2+0]; 4952 vy[i]=values[i*NDOF2+1]; 5098 4953 } 5099 4954 … … 5136 4991 xfree((void**)&doflist); 5137 4992 } 5138 5139 4993 /*}}}*/ 5140 4994 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticVert {{{1*/ 5141 4995 void Penta::InputUpdateFromSolutionDiagnosticVert(double* solution){ 5142 4996 5143 int i; 5144 5145 const int numdofpervertex=1; 5146 const int numdof=numdofpervertex*NUMVERTICES; 5147 int* doflist=NULL; 5148 double values[numdof]; 5149 double vx[NUMVERTICES]; 5150 double vy[NUMVERTICES]; 5151 double vz[NUMVERTICES]; 5152 double vzmacayeal[NUMVERTICES]; 5153 double vzpattyn[NUMVERTICES]; 5154 double vzstokes[NUMVERTICES]; 5155 double vel[NUMVERTICES]; 5156 int dummy; 5157 double pressure[NUMVERTICES]; 5158 double surface[NUMVERTICES]; 5159 double rho_ice,g; 5160 double xyz_list[NUMVERTICES][3]; 5161 5162 double* vx_ptr=NULL; 5163 double* vy_ptr=NULL; 5164 double* vzstokes_ptr=NULL; 5165 5166 int approximation; 4997 const int numdof=NDOF1*NUMVERTICES; 4998 4999 int i,dummy; 5000 int approximation; 5001 double rho_ice,g; 5002 double values[numdof]; 5003 double vx[NUMVERTICES]; 5004 double vy[NUMVERTICES]; 5005 double vz[NUMVERTICES]; 5006 double vzmacayeal[NUMVERTICES]; 5007 double vzpattyn[NUMVERTICES]; 5008 double vzstokes[NUMVERTICES]; 5009 double vel[NUMVERTICES]; 5010 double pressure[NUMVERTICES]; 5011 double surface[NUMVERTICES]; 5012 double xyz_list[NUMVERTICES][3]; 5013 int* doflist = NULL; 5014 double* vx_ptr = NULL; 5015 double* vy_ptr = NULL; 5016 double* vzstokes_ptr = NULL; 5017 5167 5018 5168 5019 /*Get the approximation and do nothing if the element in Stokes or None*/ … … 5172 5023 } 5173 5024 5174 /*Get dof list : */5025 /*Get dof list and vertices coordinates: */ 5175 5026 GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 5176 5177 /*Get node data: */5178 5027 GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES); 5179 5028 5180 /*Use the dof list to index into the solution vector: */ 5181 for(i=0;i<numdof;i++){ 5182 values[i]=solution[doflist[i]]; 5183 } 5184 5185 /*Ok, we have vz in values, fill in vz array: */ 5186 for(i=0;i<NUMVERTICES;i++){ 5187 vz[i]=values[i*numdofpervertex+0]; 5188 } 5029 /*Use the dof list to index into the solution vector vz: */ 5030 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 5031 for(i=0;i<NUMVERTICES;i++) vz[i]=values[i*NDOF1+0]; 5189 5032 5190 5033 /*Get Vx and Vy*/ … … 5234 5077 5235 5078 /*Now Compute vel*/ 5236 5237 5079 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); 5238 5080 … … 5271 5113 void Penta::InputUpdateFromSolutionDiagnosticStokes(double* solution){ 5272 5114 5273 const int numdof=NDOF4*NUMVERTICES; 5274 int i; 5275 int* doflist=NULL; 5276 double values[numdof]; 5277 double vx[NUMVERTICES]; 5278 double vy[NUMVERTICES]; 5279 double vz[NUMVERTICES]; 5280 double vel[NUMVERTICES]; 5281 double pressure[NUMVERTICES]; 5282 double stokesreconditioning; 5115 const int numdof=NDOF4*NUMVERTICES; 5116 5117 int i; 5118 double values[numdof]; 5119 double vx[NUMVERTICES]; 5120 double vy[NUMVERTICES]; 5121 double vz[NUMVERTICES]; 5122 double vel[NUMVERTICES]; 5123 double pressure[NUMVERTICES]; 5124 double stokesreconditioning; 5125 int* doflist=NULL; 5283 5126 5284 5127 /*Get dof list: */ … … 5286 5129 5287 5130 /*Use the dof list to index into the solution vector: */ 5288 for(i=0;i<numdof;i++){ 5289 values[i]=solution[doflist[i]]; 5290 } 5131 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 5291 5132 5292 5133 /*Ok, we have vx and vy in values, fill in all arrays: */ … … 5298 5139 } 5299 5140 5300 /*Recondition pressure : */5141 /*Recondition pressure and compute vel: */ 5301 5142 this->parameters->FindParam(&stokesreconditioning,StokesReconditioningEnum); 5302 for(i=0;i<NUMVERTICES;i++){ 5303 pressure[i]=pressure[i]*stokesreconditioning; 5304 } 5305 5306 /*Now Compute vel*/ 5143 for(i=0;i<NUMVERTICES;i++) pressure[i]=pressure[i]*stokesreconditioning; 5307 5144 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); 5308 5145 … … 5324 5161 xfree((void**)&doflist); 5325 5162 } 5326 5327 5163 /*}}}*/ 5328 5164 /*FUNCTION Penta::InputUpdateFromSolutionAdjointStokes {{{1*/ 5329 5165 void Penta::InputUpdateFromSolutionAdjointStokes(double* solution){ 5330 5166 5331 int i; 5332 5333 const int numdofpervertex=4; 5334 const int numdof=numdofpervertex*NUMVERTICES; 5335 int* doflist=NULL; 5336 double values[numdof]; 5337 double lambdax[NUMVERTICES]; 5338 double lambday[NUMVERTICES]; 5339 double lambdaz[NUMVERTICES]; 5340 double lambdap[NUMVERTICES]; 5167 const int numdof=NDOF4*NUMVERTICES; 5168 5169 int i; 5170 double values[numdof]; 5171 double lambdax[NUMVERTICES]; 5172 double lambday[NUMVERTICES]; 5173 double lambdaz[NUMVERTICES]; 5174 double lambdap[NUMVERTICES]; 5175 int* doflist=NULL; 5341 5176 5342 5177 /*Get dof list: */ … … 5344 5179 5345 5180 /*Use the dof list to index into the solution vector: */ 5346 for(i=0;i<numdof;i++){ 5347 values[i]=solution[doflist[i]]; 5348 } 5181 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 5349 5182 5350 5183 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5351 5184 for(i=0;i<NUMVERTICES;i++){ 5352 lambdax[i]=values[i* numdofpervertex+0];5353 lambday[i]=values[i* numdofpervertex+1];5354 lambdaz[i]=values[i* numdofpervertex+2];5355 lambdap[i]=values[i* numdofpervertex+3];5185 lambdax[i]=values[i*NDOF4+0]; 5186 lambday[i]=values[i*NDOF4+1]; 5187 lambdaz[i]=values[i*NDOF4+2]; 5188 lambdap[i]=values[i*NDOF4+3]; 5356 5189 } 5357 5190 … … 5369 5202 void Penta::InputUpdateFromSolutionAdjointHoriz(double* solution){ 5370 5203 5371 int i; 5372 5373 const int numdofpervertex=2; 5374 const int numdof=numdofpervertex*NUMVERTICES; 5375 int* doflist=NULL; 5376 double values[numdof]; 5377 double lambdax[NUMVERTICES]; 5378 double lambday[NUMVERTICES]; 5204 const int numdof=NDOF2*NUMVERTICES; 5205 5206 int i; 5207 double values[numdof]; 5208 double lambdax[NUMVERTICES]; 5209 double lambday[NUMVERTICES]; 5210 int* doflist=NULL; 5379 5211 5380 5212 /*Get dof list: */ … … 5382 5214 5383 5215 /*Use the dof list to index into the solution vector: */ 5384 for(i=0;i<numdof;i++){ 5385 values[i]=solution[doflist[i]]; 5386 } 5216 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 5387 5217 5388 5218 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 5389 5219 for(i=0;i<NUMVERTICES;i++){ 5390 lambdax[i]=values[i* numdofpervertex+0];5391 lambday[i]=values[i* numdofpervertex+1];5220 lambdax[i]=values[i*NDOF2+0]; 5221 lambday[i]=values[i*NDOF2+1]; 5392 5222 } 5393 5223 … … 5403 5233 void Penta::InputUpdateFromSolutionThermal(double* solution){ 5404 5234 5405 int i;5406 5407 5235 const int numdof=NDOF1*NUMVERTICES; 5408 int* doflist=NULL; 5409 double values[numdof]; 5410 double B[numdof]; 5411 double B_average; 5412 bool converged; 5236 5237 bool converged; 5238 int i; 5239 double values[numdof]; 5240 double B[numdof]; 5241 double B_average; 5242 int* doflist=NULL; 5413 5243 5414 5244 /*Get dof list: */ … … 5416 5246 5417 5247 /*Use the dof list to index into the solution vector: */ 5418 for(i=0;i<numdof;i++){ 5419 values[i]=solution[doflist[i]]; 5420 } 5248 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 5421 5249 5422 5250 this->inputs->GetParameterValue(&converged,ConvergedEnum); … … 5441 5269 void Penta::InputUpdateFromSolutionOneDof(double* solution,int enum_type){ 5442 5270 5443 const int numdof pervertex = 1;5444 const int numdof = numdofpervertex *NUMVERTICES; 5445 int* doflist=NULL;5446 double values[numdof];5271 const int numdof = NDOF1*NUMVERTICES; 5272 5273 double values[numdof]; 5274 int* doflist=NULL; 5447 5275 5448 5276 /*Get dof list: */ … … 5450 5278 5451 5279 /*Use the dof list to index into the solution vector: */ 5452 for(int i=0;i<numdof;i++){ 5453 values[i]=solution[doflist[i]]; 5454 } 5280 for(int i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 5455 5281 5456 5282 /*Add input to the element: */ … … 5464 5290 void Penta::InputUpdateFromSolutionOneDofCollapsed(double* solution,int enum_type){ 5465 5291 5466 const int numdof pervertex = 1;5467 const int numdof = numdofpervertex *NUMVERTICES;5468 const int numdof2d = numdof/2; 5469 int* doflist=NULL;5470 double values[numdof];5471 Penta *penta= NULL;5292 const int numdof = NDOF1*NUMVERTICES; 5293 const int numdof2d = NDOF1*NUMVERTICES2D; 5294 5295 double values[numdof]; 5296 int* doflist = NULL; 5297 Penta *penta = NULL; 5472 5298 5473 5299 /*If not on bed, return*/ … … 5486 5312 penta=this; 5487 5313 for(;;){ 5488 5489 5314 /*Add input to the element: */ 5490 5315 penta->inputs->AddInput(new PentaVertexInput(enum_type,values)); … … 5538 5363 inputs->GetParameterValue(&onshelf,ElementOnIceShelfEnum); 5539 5364 return onshelf; 5540 5541 5365 } 5542 5366 /*}}}*/ … … 5547 5371 inputs->GetParameterValue(&onwater,ElementOnWaterEnum); 5548 5372 return onwater; 5549 5550 5373 } 5551 5374 /*}}}*/ … … 5556 5379 inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum); 5557 5380 return onsurface; 5558 5559 5381 } 5560 5382 /*}}}*/ … … 5565 5387 inputs->GetParameterValue(&onbed,ElementOnBedEnum); 5566 5388 return onbed; 5567 5568 5389 } 5569 5390 /*}}}*/ … … 5574 5395 int i,node0,node1; 5575 5396 int edges[9][2]={{0,1},{0,2},{1,2},{3,4},{3,5},{4,5},{0,3},{1,4},{2,5}}; //list of the nine edges 5397 double length; 5576 5398 double minlength=-1; 5577 double length;5578 5399 5579 5400 for(i=0;i<9;i++){ … … 5593 5414 void Penta::ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp){ 5594 5415 5595 int i,j; 5596 5416 int i,j; 5597 5417 double Kii[24][24]; 5598 5418 double Kib[24][3]; … … 5630 5450 5631 5451 /*Affect value to the reduced matrix */ 5632 for(i=0;i<24;i++){ 5633 for(j=0;j<24;j++){ 5634 *(Ke_reduced+24*i+j)=Kii[i][j]-Kright[i][j]; 5635 } 5636 } 5452 for(i=0;i<24;i++) for(j=0;j<24;j++) *(Ke_reduced+24*i+j)=Kii[i][j]-Kright[i][j]; 5637 5453 } 5638 5454 /*}}}*/ … … 5640 5456 void Penta::ReduceVectorStokes(double* Pe_reduced, double* Ke_temp, double* Pe_temp){ 5641 5457 5642 int i,j; 5643 5458 int i,j; 5644 5459 double Pi[24]; 5645 5460 double Pb[3]; … … 5650 5465 5651 5466 /*Create the four matrices used for reduction */ 5652 for(i=0;i<24;i++){ 5653 Pi[i]=*(Pe_temp+i); 5654 } 5655 for(i=0;i<3;i++){ 5656 Pb[i]=*(Pe_temp+i+24); 5657 } 5467 for(i=0;i<24;i++) Pi[i]=*(Pe_temp+i); 5468 for(i=0;i<3;i++) Pb[i]=*(Pe_temp+i+24); 5658 5469 for(j=0;j<3;j++){ 5659 5470 for(i=0;i<24;i++){ … … 5674 5485 5675 5486 /*Affect value to the reduced matrix */ 5676 for(i=0;i<24;i++){ 5677 *(Pe_reduced+i)=Pi[i]-Pright[i]; 5678 } 5487 for(i=0;i<24;i++) *(Pe_reduced+i)=Pi[i]-Pright[i]; 5679 5488 } 5680 5489 /*}}}*/ … … 5688 5497 Tria* Penta::SpawnTria(int g0, int g1, int g2){ 5689 5498 5690 int i; 5691 int analysis_counter; 5499 int i,analysis_counter; 5500 int indices[3]; 5501 int zero=0; 5502 Tria* tria = NULL; 5503 Inputs* tria_inputs = NULL; 5504 Results* tria_results = NULL; 5505 Parameters* tria_parameters = NULL; 5692 5506 5693 5507 /*go into parameters and get the analysis_counter: */ 5694 5508 this->parameters->FindParam(&analysis_counter,AnalysisCounterEnum); 5695 5696 /*out of grids g0,g1 and g2 from Penta, build a tria element: */5697 Tria* tria=NULL;5698 int indices[3];5699 int zero=0;5700 Parameters* tria_parameters=NULL;5701 Inputs* tria_inputs=NULL;5702 Results* tria_results=NULL;5703 5509 5704 5510 indices[0]=g0; … … 5734 5540 void Penta::SurfaceNormal(double* surface_normal, double xyz_list[3][3]){ 5735 5541 5736 int i; 5737 double v13[3]; 5738 double v23[3]; 5542 int i; 5543 double v13[3],v23[3]; 5739 5544 double normal[3]; 5740 5545 double normal_norm;
Note:
See TracChangeset
for help on using the changeset viewer.