Changeset 678
- Timestamp:
- 06/01/09 16:10:31 (16 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Node.cpp
r503 r678 491 491 } 492 492 493 #undef __FUNCT__ 494 #define __FUNCT__ "Node::VelocityDepthAverageAtBase" 495 void Node::VelocityDepthAverageAtBase(Vec ug,double* ug_serial){ 496 497 /* node data: */ 498 int doflist1; 499 int dofx,dofy; 500 int isnodeonsurface; 501 502 Node* node=NULL; 503 Node* upper_node=NULL; 504 double velocity2[2]; 505 double velocity1[2]; 506 double velocity_average[2]; 507 double sum[2]; 508 double z1,z2,dz; 509 double thickness; 510 511 512 if(onbed==1 & clone==0){ 513 514 doflist1=GetDofList1(); 515 516 /*this node is on the bed. We are going to: 517 * follow the upper nodes until we reach the surface. At each upper node, we'll grab the 518 * velocity for this node, and add it to ug. We'll finish by 519 * we grab the velocity. Once we know the velocity, we follow the upper nodes, 520 * inserting the same velocity value into ug, until we reach the surface: */ 521 sum[0]=0; 522 sum[1]=0; 523 thickness=0; 524 525 /*get dofs for this base node velocity: we know there are two dofs in ug_serial */ 526 dofx=2*doflist1; 527 dofy=2*doflist1+1; 528 529 node=this; 530 for(;;){ 531 532 if (node->IsOnSurface())break; 533 534 doflist1=node->GetDofList1(); 535 536 velocity1[0]=ug_serial[2*doflist1]; 537 velocity1[1]=ug_serial[2*doflist1+1]; 538 z1=node->GetZ(); 539 540 upper_node=node->GetUpperNode(); 541 doflist1=upper_node->GetDofList1(); 542 543 velocity2[0]=ug_serial[2*doflist1]; 544 velocity2[1]=ug_serial[2*doflist1+1]; 545 z2=upper_node->GetZ(); 546 547 dz=(z2-z1); 548 thickness+=dz; 549 velocity_average[0]=(velocity1[0]+velocity2[0])/2.0; 550 velocity_average[1]=(velocity1[1]+velocity2[1])/2.0; 551 552 sum[0]+=velocity_average[0]*dz; 553 sum[1]+=velocity_average[1]*dz; 554 555 /* get next node: */ 556 node=node->GetUpperNode(); 557 } 558 559 sum[0]=sum[0]/thickness; 560 sum[1]=sum[1]/thickness; 561 562 /* Plug velocity_average*deltaH/H into base of ug: */ 563 VecSetValues(ug,1,&dofx,&sum[0],INSERT_VALUES); 564 VecSetValues(ug,1,&dofy,&sum[1],INSERT_VALUES); 565 } 566 } -
issm/trunk/src/c/objects/Node.h
r301 r678 77 77 int IsOnSurface(); 78 78 void FreezeDof(int dof); 79 void VelocityDepthAverageAtBase(Vec ug,double* ug_serial); 79 80 80 81 }; -
issm/trunk/src/c/objects/Penta.cpp
r608 r678 1941 1941 /* node data: */ 1942 1942 const int numgrids=6; 1943 const int numdof=2*numgrids;1944 int doflist [numdof];1943 int doflist[numgrids]; 1944 int doflist1; 1945 1945 int nodedofs[2]; 1946 int numberofdofspernode;1947 1946 1948 1947 Node* node=NULL; … … 1953 1952 if(onbed==1){ 1954 1953 1955 GetDofList (&doflist[0],&numberofdofspernode);1954 GetDofList1(&doflist[0]); 1956 1955 1957 1956 /*this penta is on the bed. For each node on the base of this penta, 1958 1957 * we grab the velocity. Once we know the velocity, we follow the upper nodes, 1959 * inserting the same velocity value into ug, until we reach the surface: */ 1958 * inserting the same velocity value into ug, until we reach the surface: 1959 * the velocity has two ddls vx and vy*/ 1960 1960 for(i=0;i<3;i++){ 1961 1961 … … 1963 1963 1964 1964 /*get velocity for this base node: */ 1965 velocity[0]=ug_serial[ doflist[numberofdofspernode*i+0]];1966 velocity[1]=ug_serial[ doflist[numberofdofspernode*i+1]];1965 velocity[0]=ug_serial[2*doflist[i]+0]; 1966 velocity[1]=ug_serial[2*doflist[i]+1]; 1967 1967 1968 1968 //go througn all nodes which sit on top of this node, until we reach the surface, … … 1970 1970 for(;;){ 1971 1971 1972 node->GetDofList(&nodedofs[0],&numberofdofspernode); 1972 doflist1=node->GetDofList1(); 1973 nodedofs[0]=2*doflist1; 1974 nodedofs[1]=2*doflist1+1; 1973 1975 VecSetValues(ug,1,&nodedofs[0],&velocity[0],INSERT_VALUES); 1974 1976 VecSetValues(ug,1,&nodedofs[1],&velocity[1],INSERT_VALUES); … … 2030 2032 2031 2033 } 2032 2033 #undef __FUNCT__2034 #define __FUNCT__ "Penta::VelocityDepthAverageAtBase"2035 void Penta::VelocityDepthAverageAtBase(Vec ug,double* ug_serial){2036 2037 /* node data: */2038 const int numgrids=6;2039 const int numdof=2*numgrids;2040 int doflist[numdof];2041 int nodedofs[2];2042 int numberofdofspernode;2043 int dofx,dofy;2044 2045 Node* node=NULL;2046 Node* upper_node=NULL;2047 int i;2048 double base_velocity[2];2049 double velocity2[2];2050 double velocity1[2];2051 double velocity_average[2];2052 double sum[2];2053 double z1,z2,dz;2054 double thickness;2055 2056 if(onbed==1){2057 2058 GetDofList(&doflist[0],&numberofdofspernode);2059 2060 /*this penta is on the bed. For each node on the base of this penta, we are going to2061 * follow the upper nodes until we reach the surface. At each upper node, we'll grab the2062 * velocity for this node, and add it to ug. We'll finish by2063 * we grab the velocity. Once we know the velocity, we follow the upper nodes,2064 * inserting the same velocity value into ug, until we reach the surface: */2065 for(i=0;i<3;i++){2066 2067 //get thickness for this grid2068 thickness=h[i]; //pick up from the penta element itself.2069 2070 node=nodes[i]; //base nodes2071 2072 /*get dofs for this base node velocity: */2073 dofx=doflist[numberofdofspernode*i+0];2074 dofy=doflist[numberofdofspernode*i+1];2075 2076 /*first thing, cancel velocity on the base nodes, so that we start with the value 0: */2077 base_velocity[0]=-ug_serial[doflist[numberofdofspernode*i+0]]; //- to cancel2078 base_velocity[1]=-ug_serial[doflist[numberofdofspernode*i+1]];2079 2080 VecSetValues(ug,1,&dofx,&base_velocity[0],ADD_VALUES);2081 VecSetValues(ug,1,&dofy,&base_velocity[1],ADD_VALUES);2082 2083 //go through all nodes which sit on top of this node, until we reach the surface,2084 //and plug deltaV*deltaH/H at base of ug: */2085 2086 for(;;){2087 2088 if (node->IsOnSurface())break;2089 2090 node->GetDofList(&nodedofs[0],&numberofdofspernode);2091 2092 velocity1[0]=ug_serial[nodedofs[0]];2093 velocity1[1]=ug_serial[nodedofs[1]];2094 z1=node->GetZ();2095 2096 upper_node=node->GetUpperNode();2097 upper_node->GetDofList(&nodedofs[0],&numberofdofspernode);2098 2099 velocity2[0]=ug_serial[nodedofs[0]];2100 velocity2[1]=ug_serial[nodedofs[1]];2101 z2=upper_node->GetZ();2102 2103 dz=(z2-z1);2104 velocity_average[0]=(velocity1[0]+velocity2[0])/2.0;2105 velocity_average[1]=(velocity1[1]+velocity2[1])/2.0;2106 2107 sum[0]=velocity_average[0]*dz/thickness;2108 sum[1]=velocity_average[1]*dz/thickness;2109 2110 /*Plug velocity_average*deltaH/H into base of ug: */2111 VecSetValues(ug,1,&dofx,&sum[0],ADD_VALUES);2112 VecSetValues(ug,1,&dofy,&sum[1],ADD_VALUES);2113 2114 /*get next node: */2115 node=node->GetUpperNode();2116 }2117 }2118 }2119 }2120 2121 2034 2122 2035 #undef __FUNCT__ -
issm/trunk/src/c/objects/Penta.h
r607 r678 113 113 void VelocityExtrude(Vec ug,double* ug_serial); 114 114 void ThicknessExtrude(Vec ug,double* ug_serial); 115 void VelocityDepthAverageAtBase(Vec ug,double* ug_serial);116 115 void SlopeExtrude(Vec sg,double* sg_serial); 117 116 void ComputePressure(Vec p_g);
Note:
See TracChangeset
for help on using the changeset viewer.