Changeset 848
- Timestamp:
- 06/08/09 15:52:02 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 9 added
- 4 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/DataSet/DataSet.cpp
r832 r848 1299 1299 1300 1300 } 1301 1302 void DataSet:: VelocityExtrude(Vec ug,double* ug_serial){1301 1302 void DataSet::FieldExtrude(Vec field,double* field_serial,char* field_name, int collapse){ 1303 1303 1304 1304 vector<Object*>::iterator object; 1305 1305 Penta* penta=NULL; 1306 Node* node=NULL; 1306 1307 1307 1308 for ( object=objects.begin() ; object < objects.end(); object++ ){ … … 1310 1311 1311 1312 penta=(Penta*)(*object); 1312 penta->VelocityExtrude(ug,ug_serial); 1313 1314 } 1315 } 1316 1317 } 1318 void DataSet::ThicknessExtrude(Vec tg,double* tg_serial){ 1319 1320 vector<Object*>::iterator object; 1321 Penta* penta=NULL; 1322 1323 for ( object=objects.begin() ; object < objects.end(); object++ ){ 1324 1325 if((*object)->Enum()==PentaEnum()){ 1326 1327 penta=(Penta*)(*object); 1328 penta->ThicknessExtrude(tg,tg_serial); 1329 1330 } 1331 } 1332 1333 } 1334 void DataSet::VelocityExtrudeAllElements(Vec ug,double* ug_serial){ 1335 1336 vector<Object*>::iterator object; 1337 Penta* penta=NULL; 1338 1339 for ( object=objects.begin() ; object < objects.end(); object++ ){ 1340 1341 if((*object)->Enum()==PentaEnum()){ 1342 1343 penta=(Penta*)(*object); 1344 penta->VelocityExtrudeAllElements(ug,ug_serial); 1345 1346 } 1347 } 1348 1349 } 1350 void DataSet::VelocityDepthAverageAtBase(Vec ug,double* ug_serial){ 1313 penta->FieldExtrude(field,field_serial,field_name,collapse); 1314 1315 } 1316 if((*object)->Enum()==NodeEnum()){ 1317 1318 node=(Node*)(*object); 1319 node->FieldExtrude(field,field_serial,field_name); 1320 1321 } 1322 } 1323 1324 } 1325 1326 void DataSet::FieldDepthAverageAtBase(Vec field,double* field_serial,char* fieldname){ 1351 1327 1352 1328 vector<Object*>::iterator object; … … 1358 1334 1359 1335 node=(Node*)(*object); 1360 node->VelocityDepthAverageAtBase(ug,ug_serial); 1361 } 1362 } 1363 1364 } 1365 void DataSet::SlopeExtrude(Vec sg,double* sg_serial){ 1366 1367 vector<Object*>::iterator object; 1368 Penta* penta=NULL; 1369 1370 for ( object=objects.begin() ; object < objects.end(); object++ ){ 1371 1372 if((*object)->Enum()==PentaEnum()){ 1373 1374 penta=(Penta*)(*object); 1375 penta->SlopeExtrude(sg,sg_serial); 1376 1336 node->FieldDepthAverageAtBase(field,field_serial,fieldname); 1377 1337 } 1378 1338 } … … 1397 1357 1398 1358 1359 void DataSet::UpdateNodePositions(double* thickness,double* bed){ 1360 1361 vector<Object*>::iterator object; 1362 Node* node=NULL; 1363 1364 for ( object=objects.begin() ; object < objects.end(); object++ ){ 1365 1366 if((*object)->Enum()==NodeEnum()){ 1367 1368 node=(Node*)(*object); 1369 node->UpdateNodePosition(thickness,bed); 1370 } 1371 } 1372 1373 1374 1375 } -
issm/trunk/src/c/DataSet/DataSet.h
r823 r848 76 76 void Gradj(Vec grad_g,double* u_g,double* lambda_g,void* inputs,int analysis_type,int sub_analysis_type,char* control_type); 77 77 void Misfit(double* pJ, double* u_g,double* u_g_obs,void* inputs,int analysis_type,int sub_analysis_type); 78 void VelocityExtrude(Vec ug,double* ug_serial); 79 void ThicknessExtrude(Vec ug,double* ug_serial); 80 void VelocityExtrudeAllElements(Vec ug,double* ug_serial); 81 void VelocityDepthAverageAtBase(Vec ug,double* ug_serial); 82 void SlopeExtrude(Vec sg,double* sg_serial); 78 void FieldDepthAverageAtBase(Vec field,double* field_serial,char* fieldname); 83 79 int DeleteObject(Object* object); 84 80 void ComputePressure(Vec p_g); 85 81 int FindResult(void* pvalue, char* name); 82 void FieldExtrude(Vec field,double* field_serial,char* field_name, int collapse); 83 void UpdateNodePositions(double* thickness,double* bed); 86 84 87 85 }; -
issm/trunk/src/c/Makefile.am
r823 r848 264 264 ./ProcessParamsx/ProcessParamsx.cpp\ 265 265 ./ProcessParamsx/ProcessParamsx.h\ 266 ./ThicknessExtrudex/ThicknessExtrudex.cpp\ 267 ./ThicknessExtrudex/ThicknessExtrudex.h\ 268 ./VelocityExtrudex/VelocityExtrudex.cpp\ 269 ./VelocityExtrudex/VelocityExtrudex.h\ 270 ./VelocityDepthAveragex/VelocityDepthAveragex.cpp\ 271 ./VelocityDepthAveragex/VelocityDepthAveragex.h\ 272 ./SlopeExtrudex/SlopeExtrudex.cpp\ 273 ./SlopeExtrudex/SlopeExtrudex.h 266 ./FieldDepthAveragex/FieldDepthAveragex.cpp\ 267 ./FieldDepthAveragex/FieldDepthAveragex.h\ 268 ./FieldExtrudex/FieldExtrudex.cpp\ 269 ./FieldExtrudex/FieldExtrudex.h 274 270 275 271 … … 532 528 ./Solverx/Solverx.cpp\ 533 529 ./Solverx/Solverx.h\ 534 ./ThicknessExtrudex/ThicknessExtrudex.cpp\535 ./ThicknessExtrudex/ThicknessExtrudex.h\536 530 ./Mergesolutionfromftogx/Mergesolutionfromftogx.cpp\ 537 531 ./Mergesolutionfromftogx/Mergesolutionfromftogx.h\ 538 532 ./ProcessParamsx/ProcessParamsx.cpp\ 539 533 ./ProcessParamsx/ProcessParamsx.h\ 540 ./VelocityExtrudex/VelocityExtrudex.cpp\ 541 ./VelocityExtrudex/VelocityExtrudex.h\ 542 ./VelocityDepthAveragex/VelocityDepthAveragex.cpp\ 543 ./VelocityDepthAveragex/VelocityDepthAveragex.h\ 544 ./SlopeExtrudex/SlopeExtrudex.cpp\ 545 ./SlopeExtrudex/SlopeExtrudex.h\ 534 ./FieldDepthAveragex/FieldDepthAveragex.cpp\ 535 ./FieldDepthAveragex/FieldDepthAveragex.h\ 536 ./FieldExtrudex/FieldExtrudex.cpp\ 537 ./FieldExtrudex/FieldExtrudex.h\ 546 538 ./parallel/diagnostic_core.cpp\ 547 539 ./parallel/diagnostic_core_linear.cpp\ -
issm/trunk/src/c/issm.h
r816 r848 34 34 #include "./UpdateFromInputsx/UpdateFromInputsx.h" 35 35 #include "./UpdateGeometryx/UpdateGeometryx.h" 36 #include "./UpdateNodePositionsx/UpdateNodePositionsx.h" 36 37 #include "./PenaltySystemMatricesx/PenaltySystemMatricesx.h" 37 38 #include "./Reducematrixfromgtofx/Reducematrixfromgtofx.h" … … 45 46 #include "./Misfitx/Misfitx.h" 46 47 #include "./ControlConstrainx/ControlConstrainx.h" 47 #include "./VelocityExtrudex/VelocityExtrudex.h" 48 #include "./VelocityDepthAveragex/VelocityDepthAveragex.h" 48 #include "./FieldDepthAveragex/FieldDepthAveragex.h" 49 49 #include "./GriddataMeshToGridx/GriddataMeshToGridx.h" 50 50 #include "./ComputePressurex/ComputePressurex.h" 51 #include "./SlopeExtrudex/SlopeExtrudex.h" 52 #include "./ThicknessExtrudex/ThicknessExtrudex.h" 51 #include "./FieldExtrudex/FieldExtrudex.h" 53 52 54 53 -
issm/trunk/src/c/objects/Node.cpp
r832 r848 550 550 551 551 #undef __FUNCT__ 552 #define __FUNCT__ "Node:: VelocityDepthAverageAtBase"553 void Node:: VelocityDepthAverageAtBase(Vec ug,double* ug_serial){552 #define __FUNCT__ "Node::FieldDepthAverageAtBase" 553 void Node::FieldDepthAverageAtBase(Vec field,double* field_serial,char* fieldname){ 554 554 555 555 /* node data: */ … … 560 560 Node* node=NULL; 561 561 Node* upper_node=NULL; 562 double velocity2[2];563 double velocity1[2];564 double velocity_average[2];565 double sum[2];566 562 double z1,z2,dz; 567 563 double thickness; 568 564 565 /*Are we on the base, not on the surface, and not on a clone node?:*/ 569 566 570 567 if(onbed==1 & clone==0 &onsurface==0){ … … 572 569 doflist1=GetDofList1(); 573 570 574 /*this node is on the bed. We are going to: 575 * follow the upper nodes until we reach the surface. At each upper node, we'll grab the 576 * velocity for this node, and add it to ug. We'll finish by 577 * we grab the velocity. Once we know the velocity, we follow the upper nodes, 578 * inserting the same velocity value into ug, until we reach the surface: */ 579 sum[0]=0; 580 sum[1]=0; 581 thickness=0; 582 583 /*get dofs for this base node velocity: we know there are two dofs in ug_serial */ 584 dofx=2*doflist1; 585 dofy=2*doflist1+1; 586 587 node=this; 588 for(;;){ 589 590 if (node->IsOnSurface())break; 591 592 doflist1=node->GetDofList1(); 571 /*this node is on the bed. We are going to, follow the upper nodes until we reach the surface. At each upper node, 572 * we'll grab the * field for this node, and add it to overall field: */ 573 574 if(strcmp(fieldname,"velocity")==0){ 575 576 /*field is a velocity, 2 dofs per node: */ 577 double velocity2[2]; 578 double velocity1[2]; 579 double velocity_average[2]; 580 double sum[2]; 581 582 sum[0]=0; 583 sum[1]=0; 584 thickness=0; 585 586 /*get dofs for this base node velocity: we know there are two dofs in field_serial */ 587 dofx=2*doflist1; 588 dofy=2*doflist1+1; 589 590 node=this; 591 for(;;){ 592 593 if (node->IsOnSurface())break; 594 595 doflist1=node->GetDofList1(); 596 597 velocity1[0]=field_serial[2*doflist1]; 598 velocity1[1]=field_serial[2*doflist1+1]; 599 z1=node->GetZ(); 600 601 upper_node=node->GetUpperNode(); 602 doflist1=upper_node->GetDofList1(); 593 603 594 velocity1[0]=ug_serial[2*doflist1]; 595 velocity1[1]=ug_serial[2*doflist1+1]; 596 z1=node->GetZ(); 597 598 upper_node=node->GetUpperNode(); 599 doflist1=upper_node->GetDofList1(); 600 601 velocity2[0]=ug_serial[2*doflist1]; 602 velocity2[1]=ug_serial[2*doflist1+1]; 603 z2=upper_node->GetZ(); 604 605 dz=(z2-z1); 606 thickness+=dz; 607 velocity_average[0]=(velocity1[0]+velocity2[0])/2.0; 608 velocity_average[1]=(velocity1[1]+velocity2[1])/2.0; 609 610 sum[0]+=velocity_average[0]*dz; 611 sum[1]+=velocity_average[1]*dz; 612 613 /* get next node: */ 614 node=node->GetUpperNode(); 604 velocity2[0]=field_serial[2*doflist1]; 605 velocity2[1]=field_serial[2*doflist1+1]; 606 z2=upper_node->GetZ(); 607 608 dz=(z2-z1); 609 thickness+=dz; 610 velocity_average[0]=(velocity1[0]+velocity2[0])/2.0; 611 velocity_average[1]=(velocity1[1]+velocity2[1])/2.0; 612 613 sum[0]+=velocity_average[0]*dz; 614 sum[1]+=velocity_average[1]*dz; 615 616 /* get next node: */ 617 node=node->GetUpperNode(); 618 } 619 620 sum[0]=sum[0]/thickness; 621 sum[1]=sum[1]/thickness; 622 623 /* Plfield velocity_average*deltaH/H into base of field: */ 624 VecSetValues(field,1,&dofx,&sum[0],INSERT_VALUES); 625 VecSetValues(field,1,&dofy,&sum[1],INSERT_VALUES); 615 626 } 616 617 sum[0]=sum[0]/thickness; 618 sum[1]=sum[1]/thickness; 619 620 /* Plug velocity_average*deltaH/H into base of ug: */ 621 VecSetValues(ug,1,&dofx,&sum[0],INSERT_VALUES); 622 VecSetValues(ug,1,&dofy,&sum[1],INSERT_VALUES); 623 } 624 } 627 else{ 628 /*field is regular, 1 dof per node: */ 629 double field2; 630 double field1; 631 double field_average; 632 double sum; 633 634 sum=0; 635 thickness=0; 636 637 /*get dofs for this base node velocity: we know there are two dofs in field_serial */ 638 dofx=doflist1; 639 640 node=this; 641 for(;;){ 642 643 if (node->IsOnSurface())break; 644 645 doflist1=node->GetDofList1(); 646 647 field1=field_serial[doflist1]; 648 z1=node->GetZ(); 649 650 upper_node=node->GetUpperNode(); 651 doflist1=upper_node->GetDofList1(); 652 653 field2=field_serial[2*doflist1]; 654 z2=upper_node->GetZ(); 655 656 dz=(z2-z1); 657 thickness+=dz; 658 field_average=(field1+field2)/2.0; 659 660 sum+=field_average*dz; 661 662 /* get next node: */ 663 node=node->GetUpperNode(); 664 } 665 666 sum=sum/thickness; 667 668 /* Plug field_average*deltH/H into base of field: */ 669 VecSetValues(field,1,&dofx,&sum,INSERT_VALUES); 670 } 671 } 672 } 673 674 #undef __FUNCT__ 675 #define __FUNCT__ "Node::FieldExtrude" 676 void Node::FieldExtrude(Vec field,double* field_serial,char* field_name){ 677 678 /* node data: */ 679 int numberofdofspernode; 680 Node* node=NULL; 681 int i; 682 683 /*Is this node on bed? :*/ 684 if (onbed){ 685 686 if (strcmp(field_name,"velocity")==0){ 687 688 /* node data: */ 689 const int numdof=2; 690 int doflist[numdof]; 691 int nodedofs[2]; 692 double fieldnode[2]; 693 694 695 GetDofList(&doflist[0],&numberofdofspernode); 696 697 //initilaize node 698 node=this; 699 700 /*get field for this base node: */ 701 fieldnode[0]=field_serial[doflist[0]]; 702 fieldnode[1]=field_serial[doflist[1]]; 703 704 //go through all nodes which sit on top of this node, until we reach the surface, 705 //and plfield field in field 706 for(;;){ 707 708 node->GetDofList(&nodedofs[0],&numberofdofspernode); 709 VecSetValues(field,1,&nodedofs[0],&fieldnode[0],INSERT_VALUES); 710 VecSetValues(field,1,&nodedofs[1],&fieldnode[1],INSERT_VALUES); 711 712 if (node->IsOnSurface())break; 713 /*get next node: */ 714 node=node->GetUpperNode(); 715 } 716 } //if (strcmp(field_name,"velocity")==0) 717 else if ( 718 (strcmp(field_name,"thickness")==0) || 719 (strcmp(field_name,"surface")==0) || 720 (strcmp(field_name,"bed")==0) || 721 (strcmp(field_name,"slopex")==0) || 722 (strcmp(field_name,"slopey")==0) 723 ){ 724 725 /* node data: */ 726 int doflist; 727 int nodedofs; 728 double fieldnode; 729 730 GetDofList(&doflist,&numberofdofspernode); 731 732 //initilaize node 733 node=this; 734 735 /*get field for this bed node: */ 736 fieldnode=field_serial[doflist]; 737 738 //go through all nodes which sit on top of this node, until we reach the surface, 739 //and pltg fieldnode in field: 740 for(;;){ 741 742 node->GetDofList(&nodedofs,&numberofdofspernode); 743 VecSetValues(field,1,&nodedofs,&fieldnode,INSERT_VALUES); 744 745 if (node->IsOnSurface())break; 746 /*get next node: */ 747 node=node->GetUpperNode(); 748 } 749 } 750 else throw ErrorException(__FUNCT__,exprintf("%s%s%s"," field ",field_name," not supported yet!")); 751 752 } //if (extrude) 753 } 754 755 void Node::UpdateNodePosition(double* thickness,double* bed){ 756 757 int dof; 758 759 dof=this->GetDofList1(); 760 761 if(onbed){ 762 763 /*this node is on the bed, set its z position to the new bed: */ 764 this->x[2]=bed[dof]; 765 } 766 else if (onsurface){ 767 768 /*this node is on the surface, set its z position to the new bed+ new thickness: */ 769 this->x[2]=bed[dof]+thickness[dof]; 770 } 771 else{ 772 /*do nothing, we only update grids belonging to the exterior layers: */ 773 } 774 } -
issm/trunk/src/c/objects/Node.h
r832 r848 81 81 int IsOnSurface(); 82 82 void FreezeDof(int dof); 83 void VelocityDepthAverageAtBase(Vec ug,double* ug_serial);83 void FieldDepthAverageAtBase(Vec field,double* field_serial,char* fieldname); 84 84 int IsOnShelf(); 85 85 int IsOnSheet(); 86 void FieldExtrude(Vec field,double* field_serial,char* field_name); 87 void UpdateNodePosition(double* thickness,double* bed); 86 88 }; 87 89 -
issm/trunk/src/c/objects/Penta.cpp
r803 r848 1922 1922 1923 1923 #undef __FUNCT__ 1924 #define __FUNCT__ "Penta:: VelocityExtrude"1925 void Penta:: VelocityExtrude(Vec ug,double* ug_serial){1926 1924 #define __FUNCT__ "Penta::FieldExtrude" 1925 void Penta::FieldExtrude(Vec field,double* field_serial,char* field_name, int iscollapsed){ 1926 1927 1927 /* node data: */ 1928 1928 const int numgrids=6; 1929 const int numdof=2*numgrids;1930 int doflist[numdof];1931 int nodedofs[2];1932 1929 int numberofdofspernode; 1933 1934 1930 Node* node=NULL; 1935 1931 int i; 1936 double velocity[2]; 1937 1938 1939 if((collapse==1) && (onbed==1)){ 1940 1941 GetDofList(&doflist[0],&numberofdofspernode); 1942 1943 /*this penta is a collapsed macayeal. For each node on the base of this penta, 1944 * we grab the velocity. Once we know the velocity, we follow the upper nodes, 1945 * inserting the same velocity value into ug, until we reach the surface: */ 1946 for(i=0;i<3;i++){ 1947 1948 node=nodes[i]; //base nodes 1949 1950 /*get velocity for this base node: */ 1951 velocity[0]=ug_serial[doflist[numberofdofspernode*i+0]]; 1952 velocity[1]=ug_serial[doflist[numberofdofspernode*i+1]]; 1953 1954 //go througn all nodes which sit on top of this node, until we reach the surface, 1955 //and plug velocity in ug 1956 for(;;){ 1957 1958 node->GetDofList(&nodedofs[0],&numberofdofspernode); 1959 VecSetValues(ug,1,&nodedofs[0],&velocity[0],INSERT_VALUES); 1960 VecSetValues(ug,1,&nodedofs[1],&velocity[1],INSERT_VALUES); 1961 1962 if (node->IsOnSurface())break; 1963 /*get next node: */ 1964 node=node->GetUpperNode(); 1932 int extrude=0; 1933 1934 /*Figure out if we should extrude for this element: */ 1935 if (iscollapsed){ 1936 /*From higher level, we are told to extrude only elements that have the collapse flag on: */ 1937 if (collapse)extrude=1; 1938 else extrude=0; 1939 } 1940 else{ 1941 /*From higher level, we are told to extrude all elements: */ 1942 extrude=1; 1943 } 1944 1945 /*Now, extrusion starts from the bed on, so double check this element is on 1946 * the bedrock: */ 1947 if(onbed==0)extrude=0; 1948 1949 /*Go on and extrude field: */ 1950 if (extrude){ 1951 1952 if (strcmp(field_name,"velocity")==0){ 1953 1954 /* node data: */ 1955 const int numdof=2*numgrids; 1956 int doflist[numdof]; 1957 int nodedofs[2]; 1958 double fieldel[2]; 1959 1960 1961 GetDofList(&doflist[0],&numberofdofspernode); 1962 1963 /*this penta is a collapsed macayeal. For each node on the base of this penta, 1964 * we grab the field. Once we know the field, we follow the upper nodes, 1965 * inserting the same field value into field, until we reach the surface: */ 1966 for(i=0;i<3;i++){ 1967 1968 node=nodes[i]; //base nodes 1969 1970 /*get field for this base node: */ 1971 fieldel[0]=field_serial[doflist[numberofdofspernode*i+0]]; 1972 fieldel[1]=field_serial[doflist[numberofdofspernode*i+1]]; 1973 1974 //go throfieldn all nodes which sit on top of this node, until we reach the surface, 1975 //and plfield field in field 1976 for(;;){ 1977 1978 node->GetDofList(&nodedofs[0],&numberofdofspernode); 1979 VecSetValues(field,1,&nodedofs[0],&fieldel[0],INSERT_VALUES); 1980 VecSetValues(field,1,&nodedofs[1],&fieldel[1],INSERT_VALUES); 1981 1982 if (node->IsOnSurface())break; 1983 /*get next node: */ 1984 node=node->GetUpperNode(); 1985 } 1965 1986 } 1987 } //if (strcmp(field_name,"velocity")==0) 1988 else if ( 1989 (strcmp(field_name,"thickness")==0) || 1990 (strcmp(field_name,"surface")==0) || 1991 (strcmp(field_name,"bed")==0) || 1992 (strcmp(field_name,"slopex")==0) || 1993 (strcmp(field_name,"slopey")==0) 1994 ){ 1995 1996 /* node data: */ 1997 const int numdof=1*numgrids; 1998 int doflist[numdof]; 1999 int nodedofs; 2000 double fieldel; 2001 2002 GetDofList(&doflist[0],&numberofdofspernode); 2003 2004 /*this penta is on the bed. For each node on the base of this penta, 2005 * we grab the thickness. Once we know the thickness, we follow the upper nodes, 2006 * inserting the same thickness value into tg, until we reach the surface: */ 2007 for(i=0;i<3;i++){ 2008 2009 node=nodes[i]; //base nodes 2010 2011 /*get velocity for this base node: */ 2012 fieldel=field_serial[doflist[numberofdofspernode*i+0]]; 2013 2014 //go through all nodes which sit on top of this node, until we reach the surface, 2015 //and pltg fieldel in field: 2016 for(;;){ 2017 2018 node->GetDofList(&nodedofs,&numberofdofspernode); 2019 VecSetValues(field,1,&nodedofs,&fieldel,INSERT_VALUES); 2020 2021 if (node->IsOnSurface())break; 2022 /*get next node: */ 2023 node=node->GetUpperNode(); 2024 } 2025 } 2026 1966 2027 } 1967 1968 } 1969 1970 } 1971 1972 #undef __FUNCT__ 1973 #define __FUNCT__ "Penta::VelocityExtrudeAllElements" 1974 void Penta::VelocityExtrudeAllElements(Vec ug,double* ug_serial){ 1975 1976 /* node data: */ 1977 const int numgrids=6; 1978 int doflist[numgrids]; 1979 int doflist1; 1980 int nodedofs[2]; 1981 1982 Node* node=NULL; 1983 int i; 1984 double velocity[2]; 1985 1986 1987 if(onbed==1){ 1988 1989 GetDofList1(&doflist[0]); 1990 1991 /*this penta is on the bed. For each node on the base of this penta, 1992 * we grab the velocity. Once we know the velocity, we follow the upper nodes, 1993 * inserting the same velocity value into ug, until we reach the surface: 1994 * the velocity has two ddls vx and vy*/ 1995 for(i=0;i<3;i++){ 1996 1997 node=nodes[i]; //base nodes 1998 1999 /*get velocity for this base node: */ 2000 velocity[0]=ug_serial[2*doflist[i]+0]; 2001 velocity[1]=ug_serial[2*doflist[i]+1]; 2002 2003 //go througn all nodes which sit on top of this node, until we reach the surface, 2004 //and plug velocity in ug 2005 for(;;){ 2006 2007 doflist1=node->GetDofList1(); 2008 nodedofs[0]=2*doflist1; 2009 nodedofs[1]=2*doflist1+1; 2010 VecSetValues(ug,1,&nodedofs[0],&velocity[0],INSERT_VALUES); 2011 VecSetValues(ug,1,&nodedofs[1],&velocity[1],INSERT_VALUES); 2012 2013 if (node->IsOnSurface())break; 2014 /*get next node: */ 2015 node=node->GetUpperNode(); 2016 } 2017 } 2018 2019 } 2020 2021 } 2022 2023 #undef __FUNCT__ 2024 #define __FUNCT__ "Penta::ThicknessExtrude" 2025 void Penta::ThicknessExtrude(Vec tg,double* tg_serial){ 2026 2027 /* node data: */ 2028 const int numgrids=6; 2029 const int numdof=1*numgrids; 2030 int doflist[numdof]; 2031 int nodedofs; 2032 int numberofdofspernode; 2033 2034 Node* node=NULL; 2035 int i; 2036 double thickness; 2037 2038 2039 if(onbed==1){ 2040 2041 GetDofList(&doflist[0],&numberofdofspernode); 2042 2043 /*this penta is on the bed. For each node on the base of this penta, 2044 * we grab the thickness. Once we know the thickness, we follow the upper nodes, 2045 * inserting the same thickness value into tg, until we reach the surface: */ 2046 for(i=0;i<3;i++){ 2047 2048 node=nodes[i]; //base nodes 2049 2050 /*get velocity for this base node: */ 2051 thickness=tg_serial[doflist[numberofdofspernode*i+0]]; 2052 2053 //go through all nodes which sit on top of this node, until we reach the surface, 2054 //and pltg velocity in tg 2055 for(;;){ 2056 2057 node->GetDofList(&nodedofs,&numberofdofspernode); 2058 VecSetValues(tg,1,&nodedofs,&thickness,INSERT_VALUES); 2059 2060 if (node->IsOnSurface())break; 2061 /*get next node: */ 2062 node=node->GetUpperNode(); 2063 } 2064 } 2065 2066 } 2067 2068 } 2069 2070 #undef __FUNCT__ 2071 #define __FUNCT__ "Penta::SlopeExtrude" 2072 void Penta::SlopeExtrude(Vec sg,double* sg_serial){ 2073 2074 /* node data: */ 2075 const int numgrids=6; 2076 const int NDOF1=1; 2077 const int numdof=NDOF1*numgrids; 2078 int doflist[numdof]; 2079 int nodedof; 2080 int numberofdofspernode; 2081 2082 Node* node=NULL; 2083 int i; 2084 double slope; 2085 2086 2087 if(onbed==1){ 2088 2089 GetDofList(&doflist[0],&numberofdofspernode); 2090 2091 if(numberofdofspernode!=1)throw ErrorException(__FUNCT__," slope can only be extruded on 1 dof per node"); 2092 2093 /*For each node on the base of this penta, we grab the slope. Once we know the slope, we follow the upper nodes, 2094 * inserting the same slope value into sg, until we reach the surface: */ 2095 2096 for(i=0;i<3;i++){ 2097 2098 node=nodes[i]; //base nodes 2099 2100 /*get velocity for this base node: */ 2101 slope=sg_serial[doflist[i]]; 2102 2103 //go throsgn all nodes which sit on top of this node, until we reach the surface, 2104 //and plsg slope in sg 2105 for(;;){ 2106 2107 node->GetDofList(&nodedof,&numberofdofspernode); 2108 VecSetValues(sg,1,&nodedof,&slope,INSERT_VALUES); 2109 2110 if (node->IsOnSurface())break; 2111 /*get next node: */ 2112 node=node->GetUpperNode(); 2113 } 2114 } 2115 2116 } 2117 2118 } 2119 2028 else throw ErrorException(__FUNCT__,exprintf("%s%s%s"," field ",field_name," not supported yet!")); 2029 2030 } //if (extrude) 2031 } 2120 2032 2121 2033 #undef __FUNCT__ -
issm/trunk/src/c/objects/Penta.h
r803 r848 111 111 void GetParameterDerivativeValue(double* p, double* p_list,double* xyz_list, double* gauss_l1l2l3l4); 112 112 void GetNodalFunctions(double* l1l2l3l4l5l6, double* gauss_l1l2l3l4); 113 void VelocityExtrudeAllElements(Vec ug,double* ug_serial); 114 void VelocityExtrude(Vec ug,double* ug_serial); 115 void ThicknessExtrude(Vec ug,double* ug_serial); 116 void SlopeExtrude(Vec sg,double* sg_serial); 113 void FieldExtrude(Vec field,double* field_serial,char* field_name, int iscollapsed); 117 114 void ComputePressure(Vec p_g); 118 115 void CreateKMatrixSlopeCompute(Mat Kgg,void* vinputs,int analysis_type,int sub_analysis_type); -
issm/trunk/src/c/parallel/diagnostic_core.cpp
r667 r848 85 85 86 86 if(debug)_printf_("%s\n","extruding slopes in 3d..."); 87 SlopeExtrudex( slopex, fem_sl->elements,fem_sl->nodes,fem_sl->loads,fem_sl->materials);88 SlopeExtrudex( slopey, fem_sl->elements,fem_sl->nodes,fem_sl->loads,fem_sl->materials);87 FieldExtrudex( slopex, fem_sl->elements,fem_sl->nodes,fem_sl->loads,fem_sl->materials,"slopex",0); 88 FieldExtrudex( slopey, fem_sl->elements,fem_sl->nodes,fem_sl->loads,fem_sl->materials,"slopex",0); 89 89 } 90 90 … … 122 122 123 123 if(debug)_printf_("%s\n"," extruding horizontal velocities..."); 124 VecDuplicatePatch(&ug_horiz,ug); VelocityExtrudex( ug_horiz,fem_dh->elements,fem_dh->nodes, fem_dh->loads,fem_dh-> materials);124 VecDuplicatePatch(&ug_horiz,ug); FieldExtrudex( ug_horiz,fem_dh->elements,fem_dh->nodes, fem_dh->loads,fem_dh-> materials,"velocity",1); 125 125 126 126 if(debug)_printf_("%s\n"," computing vertical velocities..."); … … 145 145 diagnostic_core_linear(&slopex,fem_sl,inputs,SlopeComputeAnalysisEnum(),BedXAnalysisEnum()); 146 146 diagnostic_core_linear(&slopey,fem_sl,inputs,SlopeComputeAnalysisEnum(),BedYAnalysisEnum()); 147 SlopeExtrudex( slopex, fem_sl->elements,fem_sl->nodes,fem_sl->loads,fem_sl->materials);148 SlopeExtrudex( slopey, fem_sl->elements,fem_sl->nodes,fem_sl->loads,fem_sl->materials);147 FieldExtrudex( slopex, fem_sl->elements,fem_sl->nodes,fem_sl->loads,fem_sl->materials,"slopex",0); 148 FieldExtrudex( slopey, fem_sl->elements,fem_sl->nodes,fem_sl->loads,fem_sl->materials,"slopey",0); 149 149 150 150 inputs->Add("bedslopex",slopex,numberofdofspernode_sl,numberofnodes); -
issm/trunk/src/c/parallel/prognostic_core.cpp
r668 r848 39 39 _printf_("depth averaging velocity..."); 40 40 u_g=inputs->Get("velocity",&dofs[0],2); //take (vx,vy) from inputs velocity 41 VelocityDepthAveragex( u_g, fem->elements,fem->nodes, fem->loads, fem->materials);41 FieldDepthAveragex( u_g, fem->elements,fem->nodes, fem->loads, fem->materials,"velocity"); 42 42 inputs->Add("velocity_average",u_g,2,numberofnodes); 43 43 … … 46 46 47 47 _printf_("extrude computed thickness on all layers:\n"); 48 ThicknessExtrudex( h_g, fem->elements,fem->nodes, fem->loads, fem->materials);48 FieldExtrudex( h_g, fem->elements,fem->nodes, fem->loads, fem->materials,"thickness",0); 49 49 50 50 /*Plug results into output dataset: */
Note:
See TracChangeset
for help on using the changeset viewer.