Changeset 15967
- Timestamp:
- 08/27/13 08:35:37 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r15964 r15967 2779 2779 2780 2780 for(i=0;i<NUMVERTICES;i++){ 2781 if ( reCast<bool,IssmDouble>(flags[nodes[i]->Sid()])){2781 if (flags[vertices[i]->Sid()]<0.){ 2782 2782 shelf=true; 2783 2783 break; … … 11200 11200 #ifdef _HAVE_GROUNDINGLINE_ 11201 11201 /*FUNCTION Penta::MigrateGroundingLine{{{*/ 11202 void Penta::MigrateGroundingLine(IssmDouble* sheet_ungrounding){11202 void Penta::MigrateGroundingLine(IssmDouble* phi_ungrounding){ 11203 11203 11204 11204 int i,migration_style; … … 11253 11253 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false)); 11254 11254 } 11255 else if(migration_style==SoftMigrationEnum && reCast<int,IssmDouble>(sheet_ungrounding[vertices[i]->Sid()])){ 11255 //else if(migration_style==SoftMigrationEnum && reCast<int,IssmDouble>(sheet_ungrounding[vertices[i]->Sid()])){ 11256 else if(migration_style==SoftMigrationEnum && phi_ungrounding[vertices[i]->Sid()]<0.){ 11256 11257 s[i] = (1-density)*h[i]; 11257 11258 b[i] = -density*h[i]; … … 11302 11303 if(migration_style==SoftMigrationEnum){ 11303 11304 bed_hydro=-density*h[i]; 11304 if(phi[i]<0. || bed_hydro<=r[i] || reCast<bool>(sheet_ungrounding[nodes[i]->Sid()])){ 11305 //if(phi[i]<0. || bed_hydro<=r[i] || reCast<bool>(sheet_ungrounding[nodes[i]->Sid()])){ 11306 if(phi[i]<0. || bed_hydro<=r[i] || phi_ungrounding[vertices[i]->Sid()]<0.){ 11305 11307 phi[i]=h[i]+r[i]/density; 11306 11308 } … … 11356 11358 for(i=0;i<NUMVERTICES;i++){ 11357 11359 if (reCast<bool,IssmDouble>(vertices_potentially_ungrounding[nodes[i]->Sid()])){ 11358 vec_nodes_on_iceshelf->SetValue(vertices[i]->Sid(), 1,INS_VAL);11360 vec_nodes_on_iceshelf->SetValue(vertices[i]->Sid(),-1.,INS_VAL); 11359 11361 11360 11362 /*If node was not on ice shelf, we flipped*/ 11361 if(nodes_on_iceshelf[vertices[i]->Sid()] ==0){11363 if(nodes_on_iceshelf[vertices[i]->Sid()]>=0.){ 11362 11364 nflipped++; 11363 11365 } -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r15965 r15967 1981 1981 1982 1982 for(i=0;i<NUMVERTICES;i++){ 1983 if ( reCast<bool>(flags[nodes[i]->Sid()])){1983 if (flags[vertices[i]->Sid()]<0.){ 1984 1984 shelf=true; 1985 1985 break; … … 7312 7312 #ifdef _HAVE_GROUNDINGLINE_ 7313 7313 /*FUNCTION Tria::MigrateGroundingLine{{{*/ 7314 void Tria::MigrateGroundingLine(IssmDouble* sheet_ungrounding){7314 void Tria::MigrateGroundingLine(IssmDouble* phi_ungrounding){ 7315 7315 7316 7316 int i,migration_style; … … 7363 7363 nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false)); 7364 7364 } 7365 else if(migration_style==SoftMigrationEnum && reCast<bool>(sheet_ungrounding[vertices[i]->Sid()])){7366 //else if(migration_style==SoftMigrationEnum && phi_ungrounding[vertices[i]->Sid()]<0.){7365 //else if(migration_style==SoftMigrationEnum && reCast<bool>(sheet_ungrounding[vertices[i]->Sid()])){ 7366 else if(migration_style==SoftMigrationEnum && phi_ungrounding[vertices[i]->Sid()]<0.){ 7367 7367 s[i] = (1-density)*h[i]; 7368 7368 b[i] = -density*h[i]; … … 7414 7414 if(migration_style==SoftMigrationEnum){ 7415 7415 bed_hydro=-density*h[i]; 7416 //if(phi[i]<0. || bed_hydro<=r[i] || phi_ungrounding[vertices[i]->Sid()]<0.){7417 if(phi[i]<0. || bed_hydro<=r[i] || reCast<bool>(sheet_ungrounding[vertices[i]->Sid()])){7416 if(phi[i]<0. || bed_hydro<=r[i] || phi_ungrounding[vertices[i]->Sid()]<0.){ 7417 //if(phi[i]<0. || bed_hydro<=r[i] || reCast<bool>(sheet_ungrounding[vertices[i]->Sid()])){ 7418 7418 phi[i]=h[i]+r[i]/density; 7419 7419 } … … 7461 7461 for(i=0;i<3;i++){ 7462 7462 if (reCast<bool>(vertices_potentially_ungrounding[vertices[i]->Sid()])){ 7463 vec_nodes_on_iceshelf->SetValue(vertices[i]->Sid(), 1,INS_VAL);7463 vec_nodes_on_iceshelf->SetValue(vertices[i]->Sid(),-1.,INS_VAL); 7464 7464 7465 7465 /*If node was not on ice shelf, we flipped*/ 7466 if(nodes_on_iceshelf[vertices[i]->Sid()] ==0){7466 if(nodes_on_iceshelf[vertices[i]->Sid()]>=0.){ 7467 7467 nflipped++; 7468 7468 } -
issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
r15962 r15967 51 51 } 52 52 53 /*FUNCTION CreateNodesOnFloatingIce {{{*/54 Vector<IssmDouble>* CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type){55 56 int i,numnods;57 Vector<IssmDouble>* vec_nodes_on_floatingice = NULL;58 Node *node = NULL;59 60 /*First, initialize nodes_on_floatingice, which will track which nodes have changed status: */61 numnods=nodes->NumberOfNodes(configuration_type);62 vec_nodes_on_floatingice=new Vector<IssmDouble>(numnods);63 64 /*Loop through nodes, and fill vec_nodes_on_floatingice: */65 for(i=0;i<nodes->Size();i++){66 node=(Node*)nodes->GetObjectByOffset(i);67 if(node->InAnalysis(configuration_type)){68 if(node->IsFloating()){69 vec_nodes_on_floatingice->SetValue(node->Sid(),1.0,INS_VAL);70 }71 }72 }73 74 /*Assemble vector: */75 vec_nodes_on_floatingice->Assemble();76 77 return vec_nodes_on_floatingice;78 }79 /*%}}}*/80 53 /*FUNCTION PotentialUngrounding {{{*/ 81 54 IssmDouble* PotentialUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters){ … … 111 84 int numberofvertices; 112 85 int nflipped,local_nflipped; 113 IssmDouble* nodes_on_floatingice= NULL;86 IssmDouble* phi = NULL; 114 87 IssmDouble* elements_neighboring_floatingce = NULL; 115 88 Vector<IssmDouble>* vec_elements_neighboring_floatingice = NULL; 116 Vector<IssmDouble>* vec_ nodes_on_floatingice= NULL;89 Vector<IssmDouble>* vec_phi = NULL; 117 90 Node* node = NULL; 118 91 Element* element = NULL; … … 122 95 numberofvertices=vertices->NumberOfVertices(); 123 96 124 /*recover vec_nodes_on_floatingice*/ 125 vec_nodes_on_floatingice=CreateNodesOnFloatingIce(nodes,analysis_type); 126 nodes_on_floatingice=vec_nodes_on_floatingice->ToMPISerial(); 97 /*recover vec_phi*/ 98 vec_phi=new Vector<IssmDouble>(vertices->NumberOfVertices()); 99 for(i=0;i<elements->Size();i++){ 100 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 101 element->GetVectorFromInputs(vec_phi,MaskGroundediceLevelsetEnum); 102 } 103 phi=vec_phi->ToMPISerial(); 127 104 128 105 nflipped=1; //bootstrap … … 135 112 for(i=0;i<elements->Size();i++){ 136 113 element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 137 vec_elements_neighboring_floatingice->SetValue(element->Sid(),element->IsNodeOnShelfFromFlags( nodes_on_floatingice)?1.0:0.0,INS_VAL);114 vec_elements_neighboring_floatingice->SetValue(element->Sid(),element->IsNodeOnShelfFromFlags(phi)?1.0:0.0,INS_VAL); 138 115 } 139 116 … … 147 124 element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 148 125 if(reCast<int,IssmDouble>(elements_neighboring_floatingce[element->Sid()])){ 149 local_nflipped+=element->UpdatePotentialUngrounding(vertices_potentially_ungrounding,vec_ nodes_on_floatingice,nodes_on_floatingice);126 local_nflipped+=element->UpdatePotentialUngrounding(vertices_potentially_ungrounding,vec_phi,phi); 150 127 } 151 128 } 152 vec_ nodes_on_floatingice->Assemble();129 vec_phi->Assemble(); 153 130 154 131 ISSM_MPI_Allreduce(&local_nflipped,&nflipped,1,ISSM_MPI_INT,ISSM_MPI_SUM,IssmComm::GetComm()); … … 157 134 /*Avoid leaks: */ 158 135 xDelete<IssmDouble>(elements_neighboring_floatingce); 159 xDelete<IssmDouble>( nodes_on_floatingice);136 xDelete<IssmDouble>(phi); 160 137 161 138 /*Assemble and serialize:*/ 162 139 delete vec_elements_neighboring_floatingice; 163 nodes_on_floatingice=vec_nodes_on_floatingice->ToMPISerial();140 phi=vec_phi->ToMPISerial(); 164 141 } 165 142 166 143 /*Free ressources:*/ 167 delete vec_ nodes_on_floatingice;144 delete vec_phi; 168 145 xDelete<IssmDouble>(elements_neighboring_floatingce); 169 146 170 return nodes_on_floatingice;147 return phi; 171 148 } 172 149 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.