Changeset 7319
- Timestamp:
- 02/03/11 16:23:38 (14 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Element.h
r7288 r7319 83 83 virtual int* GetHorizontalNeighboorSids(void)=0; 84 84 virtual double TimeAdapt()=0; 85 virtual void AgressiveMigration()=0; 86 virtual void AgressiveShelfSync()=0; 85 87 virtual void MigrateGroundingLine()=0; 86 88 virtual int UpdateShelfStatus(Vec new_shelf_nodes)=0; -
issm/trunk/src/c/objects/Elements/Penta.cpp
r7288 r7319 302 302 void Penta::AverageOntoPartition(Vec partition_contributions,Vec partition_areas,double* vertex_response,double* qmu_part){ 303 303 _error_("Not supported yet!"); 304 } 305 /*}}}*/ 306 /*FUNCTION Penta::AgressiveMigration{{{1*/ 307 void Penta::AgressiveMigration(void){ 308 _error_("not supported yet!"); 309 } 310 /*}}}*/ 311 /*FUNCTION Penta::AgressiveShelfSync{{{1*/ 312 void Penta::AgressiveShelfSync(void){ 313 _error_("not supported yet!"); 304 314 } 305 315 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Penta.h
r7288 r7319 109 109 void MaxVy(double* pmaxvy, bool process_units); 110 110 void MaxVz(double* pmaxvz, bool process_units); 111 void AgressiveMigration(); 112 void AgressiveShelfSync(); 111 113 void MigrateGroundingLine(); 112 114 void MinVel(double* pminvel, bool process_units); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r7288 r7319 276 276 277 277 /*Other*/ 278 /*FUNCTION Tria::AgressiveMigration{{{1*/ 279 void Tria::AgressiveMigration(void){ 280 281 282 double *values = NULL; 283 double h[3],s[3],b[3],ba[3]; 284 double bed_hydro; 285 double rho_water,rho_ice,density; 286 int i; 287 bool elementonshelf = false; 288 289 /*Recover info at the vertices: */ 290 Input* surface_input =inputs->GetInput(SurfaceEnum); _assert_(surface_input); 291 Input* bed_input =inputs->GetInput(BedEnum); _assert_(bed_input); 292 if((surface_input->Enum()!=TriaVertexInputEnum) | (bed_input->Enum()!=TriaVertexInputEnum))_error_(" not supported yet for bed and surface interpolations not P1!"); 293 294 GetParameterListOnVertices(&h[0],ThicknessEnum); 295 GetParameterListOnVertices(&s[0],SurfaceEnum); 296 GetParameterListOnVertices(&b[0],BedEnum); 297 GetParameterListOnVertices(&ba[0],BathymetryEnum); 298 299 /*material parameters: */ 300 rho_water=matpar->GetRhoWater(); 301 rho_ice=matpar->GetRhoIce(); 302 density=rho_ice/rho_water; 303 304 /*go through vertices, and update inputs, considering them to be TriaVertex type: */ 305 for(i=0;i<3;i++){ 306 if (nodes[i]->IsOnShelf()){ 307 /*This node is on the shelf. See if its bed is going under the bathymetry: */ 308 if(b[i]<=ba[i]){ //<= because Neff being 0 when b=ba, drag will be 0 anyway. 309 /*The ice shelf is getting grounded, the thickness is the same, so just update the bed to stick to the bathymetry and elevate the surface accordingly: */ 310 b[i]=ba[i]; 311 s[i]=b[i]+h[i]; 312 } 313 else{ 314 /*do nothing, we are still floating.*/ 315 } 316 } 317 else{ 318 /*This node is on the sheet, near the grounding line. See if wants to unground. To 319 * do so, we compute the hydrostatic bed, and if it is > bathymetry, then we unground: */ 320 bed_hydro=-density*h[i]; 321 if (bed_hydro>ba[i]){ 322 /*We are now floating, bed and surface are determined from hydrostatic equilibrium: */ 323 s[i]=(1-density)*h[i]; 324 b[i]=-density*h[i]; 325 } 326 else{ 327 /*do nothing, we are still grounded.*/ 328 } 329 } 330 } 331 332 /*Surface and bed are updated. Update inputs:*/ 333 surface_input->GetValuesPtr(&values,NULL); for(i=0;i<3;i++)values[i]=s[i]; 334 bed_input->GetValuesPtr(&values,NULL); for(i=0;i<3;i++)values[i]=b[i]; 335 336 } 337 /*}}}*/ 338 /*FUNCTION Tria::AgressiveShelfSync{{{1*/ 339 void Tria::AgressiveShelfSync(void){ 340 341 342 double *values = NULL; 343 double h[3],s[3],b[3],ba[3]; 344 double bed_hydro; 345 double rho_water,rho_ice,density; 346 int i; 347 bool elementonshelf = false; 348 349 /*Recover info at the vertices: */ 350 Input* surface_input =inputs->GetInput(SurfaceEnum); _assert_(surface_input); 351 Input* bed_input =inputs->GetInput(BedEnum); _assert_(bed_input); 352 if((surface_input->Enum()!=TriaVertexInputEnum) | (bed_input->Enum()!=TriaVertexInputEnum))_error_(" not supported yet for bed and surface interpolations not P1!"); 353 354 GetParameterListOnVertices(&h[0],ThicknessEnum); 355 GetParameterListOnVertices(&s[0],SurfaceEnum); 356 GetParameterListOnVertices(&b[0],BedEnum); 357 GetParameterListOnVertices(&ba[0],BathymetryEnum); 358 359 /*material parameters: */ 360 rho_water=matpar->GetRhoWater(); 361 rho_ice=matpar->GetRhoIce(); 362 density=rho_ice/rho_water; 363 364 /*go through vertices, and update inputs, considering them to be TriaVertex type: */ 365 for(i=0;i<3;i++){ 366 if(b[i]==ba[i]){ 367 368 nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,false)); 369 nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,true)); 370 } 371 else{ 372 nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,true)); 373 nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,false)); 374 375 } 376 } 377 378 /*Now, update shelf status of element. An element can only be on shelf if all its nodes are on shelf: */ 379 elementonshelf=false; 380 for(i=0;i<3;i++){ 381 if(nodes[i]->IsOnShelf()){ 382 elementonshelf=true; 383 break; 384 } 385 } 386 this->inputs->AddInput(new BoolInput(ElementOnIceShelfEnum,elementonshelf)); 387 } 388 /*}}}*/ 278 389 /*FUNCTION Tria::AverageOntoPartition {{{1*/ 279 390 void Tria::AverageOntoPartition(Vec partition_contributions,Vec partition_areas,double* vertex_response,double* qmu_part){ … … 3599 3710 this->inputs->AddInput(new TriaVertexInput(BedEnum,nodeinputs)); 3600 3711 } 3601 if(iomodel->gl_migration ){3712 if(iomodel->gl_migration!=NoneEnum){ 3602 3713 for(i=0;i<3;i++)nodeinputs[i]=iomodel->bathymetry[tria_vertex_ids[i]-1]; 3603 3714 this->inputs->AddInput(new TriaVertexInput(BathymetryEnum,nodeinputs)); … … 4422 4533 GetParameterListOnVertices(&b[0],BedEnum); 4423 4534 GetParameterListOnVertices(&ba[0],BathymetryEnum); 4424 for(i=0;i<3;i++)isonshelf[i]=nodes[i]->IsOnShelf(); 4535 for(i=0;i<3;i++){ 4536 isonshelf[i]=nodes[i]->IsOnShelf(); 4537 if((nodes[i]->Sid()+1)==36)printf("MigrateGroundingLine: El %i Node %i shelf status %i\n",this->Id(),nodes[i]->Sid()+1,isonshelf[i]); 4538 } 4425 4539 4426 4540 /*material parameters: */ … … 4437 4551 b[i]=ba[i]; 4438 4552 s[i]=b[i]+h[i]; 4439 //printf("Node id %i is starting to ground\n",nodes[i]->Id());4553 if((nodes[i]->Sid()+1)==36)printf("MigrateGroundingLine: El %i Node %i grounding %g %g %g\n",this->Id(),nodes[i]->Sid()+1,b[i],ba[i],s[i]); 4440 4554 } 4441 4555 else{ 4442 4556 /*do nothing, we are still floating.*/ 4557 if((nodes[i]->Sid()+1)==36)printf("MigrateGroundingLine: El %i Node %i still floating %g %g %g\n",this->Id(),nodes[i]->Sid()+1,b[i],ba[i],s[i]); 4443 4558 } 4444 4559 } … … 4451 4566 s[i]=(1-density)*h[i]; 4452 4567 b[i]=-density*h[i]; 4453 //printf("Node id %i is starting to float\n",nodes[i]->Id()); 4568 printf("%i\n",nodes[i]->Sid()+1); 4569 if((nodes[i]->Sid()+1)==36)printf("MigrateGroundingLine: El %i Node %i floating %g %g %g\n",this->Id(),nodes[i]->Sid()+1,b[i],ba[i],s[i]); 4454 4570 } 4455 4571 else{ 4456 4572 /*do nothing, we are still grounded.*/ 4573 if((nodes[i]->Sid()+1)==36)printf("MigrateGroundingLine: El %i Node %i still grounded %g %g %g\n",this->Id(),nodes[i]->Sid()+1,b[i],ba[i],s[i]); 4457 4574 } 4458 4575 } … … 4462 4579 surface_input->GetValuesPtr(&values,NULL); for(i=0;i<3;i++)values[i]=s[i]; 4463 4580 bed_input->GetValuesPtr(&values,NULL); for(i=0;i<3;i++)values[i]=b[i]; 4464 4581 4582 for(i=0;i<3;i++){ 4583 isonshelf[i]=nodes[i]->IsOnShelf(); 4584 if((nodes[i]->Sid()+1)==36)printf("MigrateGroundingLine: El %i Node %i second shelf status %i\n",this->Id(),nodes[i]->Sid()+1,isonshelf[i]); 4585 } 4465 4586 } 4466 4587 /*}}}*/ … … 5344 5465 bool elementonshelf = false; 5345 5466 int flipped=0; 5346 boolshelfstatus[3];5467 int shelfstatus[3]; 5347 5468 5348 5469 … … 5364 5485 /*Initialize current status of nodes: */ 5365 5486 for(i=0;i<3;i++){ 5366 shelfstatus[i]=nodes[i]->inputs->GetInput(NodeOnIceShelfEnum); 5487 shelfstatus[i]=nodes[i]->IsOnShelf(); 5488 if((nodes[i]->Sid()+1)==36) printf("UpdateShelfStatus: El %i Node %i shelf status %i\n",this->Id(),nodes[i]->Sid()+1,shelfstatus[i]); 5367 5489 } 5368 5490 … … 5370 5492 flipped=0; 5371 5493 for(i=0;i<3;i++){ 5372 if(b[i]<=ba[i]){ 5494 if(b[i]<=ba[i]){ //the = will lead to oscillations. 5373 5495 nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,false)); 5374 5496 nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,true)); 5375 if(shelfstatus[i])flipped++; 5376 //printf("node %i flipping to sheet\n",nodes[i]->Sid()); 5497 if(shelfstatus[i]){ 5498 flipped++; 5499 if((nodes[i]->Sid()+1)==36)printf("UpdateShelfStatus: El %i Node %i grounding %g %g %g\n",this->Id(),nodes[i]->Sid()+1,b[i],ba[i],s[i]); 5500 } 5377 5501 VecSetValue(new_shelf_nodes,nodes[i]->Sid(),0,INSERT_VALUES); 5378 5502 } … … 5380 5504 nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,true)); 5381 5505 nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,false)); 5382 if(!shelfstatus[i])flipped++; 5383 //printf("node %i flipping to shelf\n",nodes[i]->Sid()); 5506 if(!shelfstatus[i]){ 5507 flipped++; 5508 if((nodes[i]->Sid()+1)==36)printf("UpdateShelfStatus: El %i Node %i floating %g %g %g\n",this->Id(),nodes[i]->Sid()+1,b[i],ba[i],s[i]); 5509 } 5384 5510 VecSetValue(new_shelf_nodes,nodes[i]->Sid(),1,INSERT_VALUES); 5385 5511 } … … 5405 5531 bool flag; 5406 5532 int i; 5533 double h[3]; 5534 double s[3]; 5535 double b[3]; 5536 double ba[3]; 5537 5538 GetParameterListOnVertices(&h[0],ThicknessEnum); 5539 GetParameterListOnVertices(&s[0],SurfaceEnum); 5540 GetParameterListOnVertices(&b[0],BedEnum); 5541 GetParameterListOnVertices(&ba[0],BathymetryEnum); 5407 5542 5408 5543 for(i=0;i<3;i++){ -
issm/trunk/src/c/objects/Elements/Tria.h
r7288 r7319 113 113 void MaxVy(double* pmaxvy, bool process_units); 114 114 void MaxVz(double* pmaxvz, bool process_units); 115 void AgressiveMigration(); 116 void AgressiveShelfSync(); 115 117 void MigrateGroundingLine(); 116 118 void MinVel(double* pminvel, bool process_units);
Note:
See TracChangeset
for help on using the changeset viewer.