Changeset 4907
- Timestamp:
- 07/30/10 12:26:24 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Makefile.am
r4899 r4907 548 548 ./modules/Qmux/SpawnCore.cpp\ 549 549 ./modules/Qmux/SpawnCoreSerial.cpp\ 550 ./modules/FieldAverageOntoVerticesx/FieldAverageOntoVerticesx.cpp\551 ./modules/FieldAverageOntoVerticesx/FieldAverageOntoVerticesx.h\552 ./modules/FieldDepthAveragex/FieldDepthAveragex.cpp\553 ./modules/FieldDepthAveragex/FieldDepthAveragex.h\554 550 ./modules/InputDepthAveragex/InputDepthAveragex.cpp\ 555 551 ./modules/InputDepthAveragex/InputDepthAveragex.h\ … … 1099 1095 ./modules/Qmux/SpawnCore.cpp\ 1100 1096 ./modules/Qmux/SpawnCoreParallel.cpp\ 1101 ./modules/FieldAverageOntoVerticesx/FieldAverageOntoVerticesx.cpp\1102 ./modules/FieldAverageOntoVerticesx/FieldAverageOntoVerticesx.h\1103 ./modules/FieldDepthAveragex/FieldDepthAveragex.cpp\1104 ./modules/FieldDepthAveragex/FieldDepthAveragex.h\1105 1097 ./modules/InputDepthAveragex/InputDepthAveragex.cpp\ 1106 1098 ./modules/InputDepthAveragex/InputDepthAveragex.h\ -
issm/trunk/src/c/modules/modules.h
r4841 r4907 22 22 #include "./DakotaResponsesx/DakotaResponsesx.h" 23 23 #include "./ElementConnectivityx/ElementConnectivityx.h" 24 #include "./FieldAverageOntoVerticesx/FieldAverageOntoVerticesx.h"25 #include "./FieldDepthAveragex/FieldDepthAveragex.h"26 24 #include "./GetSolutionFromInputsx/GetSolutionFromInputsx.h" 27 25 #include "./GetVectorFromInputsx/GetVectorFromInputsx.h" -
issm/trunk/src/c/objects/Node.cpp
r4575 r4907 502 502 } 503 503 /*}}}*/ 504 /*FUNCTION Node::FieldAverageOntoVertices{{{1*/505 void Node::FieldAverageOntoVertices(Vec fieldsum,Vec connectivity,double* field){506 507 /*Intermediary*/508 int vertexdof;509 int index;510 double value;511 512 /*Skip if clone*/513 if (indexing.clone==1) return;514 515 /*Check dofpernode*/516 if (indexing.numberofdofs!=1) ISSMERROR("only one dof suppoerted yet");517 518 /*Get value at node*/519 index=indexing.doflist[0];520 value=field[index];521 522 /*Add values to the two vectors*/523 vertexdof=this->GetVertexDof();524 VecSetValue(fieldsum, vertexdof,value,ADD_VALUES);525 VecSetValue(connectivity,vertexdof,1.0, ADD_VALUES);526 }527 /*}}}*/528 /*FUNCTION Node::FieldDepthAverageAtBase{{{1*/529 void Node::FieldDepthAverageAtBase(Vec field,double* field_serial,char* fieldname){530 531 /* node data: */532 int vertexdof;533 int dofx,dofy;534 int isnodeonsurface;535 536 bool onbed;537 bool onsurface;538 539 Node* node=NULL;540 Node* upper_node=NULL;541 double z1,z2,dz;542 double thickness;543 544 /*recover parameters: */545 inputs->GetParameterValue(&onbed,NodeOnBedEnum);546 inputs->GetParameterValue(&onsurface,NodeOnSurfaceEnum);547 548 /*Are we on the base, not on the surface, and not on a clone node?:*/549 550 if(onbed==1 & indexing.clone==0 & onsurface==0){551 552 vertexdof=this->GetVertexDof();553 554 /*this node is on the bed. We are going to, follow the upper nodes until we reach the surface. At each upper node,555 * we'll grab the * field for this node, and add it to overall field: */556 557 if(strcmp(fieldname,"velocity")==0){558 559 /*field is a velocity, 2 dofs per node: */560 double velocity2[2];561 double velocity1[2];562 double velocity_average[2];563 double sum[2];564 565 sum[0]=0;566 sum[1]=0;567 thickness=0;568 569 /*get dofs for this base node velocity: we know there are two dofs in field_serial */570 dofx=2*vertexdof;571 dofy=2*vertexdof+1;572 573 node=this;574 for(;;){575 576 if (node->IsOnSurface())break;577 578 vertexdof=node->GetVertexDof();579 580 velocity1[0]=field_serial[2*vertexdof];581 velocity1[1]=field_serial[2*vertexdof+1];582 z1=node->GetZ();583 584 upper_node=node->GetUpperNode();585 vertexdof=upper_node->GetVertexDof();586 587 velocity2[0]=field_serial[2*vertexdof];588 velocity2[1]=field_serial[2*vertexdof+1];589 z2=upper_node->GetZ();590 591 dz=(z2-z1);592 thickness+=dz;593 velocity_average[0]=(velocity1[0]+velocity2[0])/2.0;594 velocity_average[1]=(velocity1[1]+velocity2[1])/2.0;595 596 sum[0]+=velocity_average[0]*dz;597 sum[1]+=velocity_average[1]*dz;598 599 /* get next node: */600 node=node->GetUpperNode();601 }602 603 sum[0]=sum[0]/thickness;604 sum[1]=sum[1]/thickness;605 606 /* Plfield velocity_average*deltaH/H into base of field: */607 VecSetValues(field,1,&dofx,&sum[0],INSERT_VALUES);608 VecSetValues(field,1,&dofy,&sum[1],INSERT_VALUES);609 }610 else{611 /*field is regular, 1 dof per node: */612 double field2;613 double field1;614 double field_average;615 double sum;616 617 sum=0;618 thickness=0;619 620 /*get dofs for this base node velocity: we know there are two dofs in field_serial */621 dofx=vertexdof;622 623 node=this;624 for(;;){625 626 if (node->IsOnSurface()) break;627 628 vertexdof=node->GetVertexDof();629 630 field1=field_serial[vertexdof];631 z1=node->GetZ();632 633 upper_node=node->GetUpperNode();634 vertexdof=upper_node->GetVertexDof();635 636 field2=field_serial[vertexdof];637 z2=upper_node->GetZ();638 639 dz=(z2-z1);640 thickness+=dz;641 field_average=(field1+field2)/2.0;642 643 sum+=field_average*dz;644 645 /* get next node: */646 node=node->GetUpperNode();647 }648 649 sum=sum/thickness;650 651 /* Plug field_average*deltH/H into base of field: */652 VecSetValues(field,1,&dofx,&sum,INSERT_VALUES);653 }654 }655 }656 /*}}}*/657 504 /*FUNCTION Node::VecExtrude {{{1*/ 658 505 void Node::VecExtrude(Vec vector,double* vector_serial){ -
issm/trunk/src/c/objects/Node.h
r4575 r4907 88 88 int IsOnSurface(); 89 89 void FreezeDof(int dof); 90 void FieldAverageOntoVertices(Vec fieldsum,Vec connectivity,double* field);91 void FieldDepthAverageAtBase(Vec field,double* field_serial,char* fieldname);92 90 int IsOnShelf(); 93 91 int IsOnSheet();
Note:
See TracChangeset
for help on using the changeset viewer.