Changeset 18502
- Timestamp:
- 09/10/14 22:14:07 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/SeaiceAnalysis.cpp
r18501 r18502 321 321 }/*}}}*/ 322 322 void SeaiceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 323 /*Default, do nothing*/ 324 return; 323 324 /*Intermediaries*/ 325 Vector<IssmDouble>* mask = NULL; 326 IssmDouble* serial_mask = NULL; 327 328 /*Step 1: update mask of active nodes*/ 329 mask=new Vector<IssmDouble>(femmodel->nodes->NumberOfNodes(SeaiceAnalysisEnum)); 330 for (int i=0;i<femmodel->elements->Size();i++){ 331 Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i)); 332 333 /*Get current concentration of element and decide whether it is an active element*/ 334 int numnodes = element->GetNumberOfNodes(); 335 Input* concentration_input = element->GetInput(SeaiceConcentrationEnum); _assert_(concentration_input); 336 if(concentration_input->Max()>0.){ 337 for(int in=0;in<numnodes;in++) mask->SetValue(element->nodes[in]->Sid(),1.,INS_VAL); 338 } 339 } 340 341 /*Assemble and serialize*/ 342 mask->Assemble(); 343 serial_mask=mask->ToMPISerial(); 344 delete mask; 345 346 /*Update node activation accordingly*/ 347 int counter =0; 348 for(int i=0;i<femmodel->nodes->Size();i++){ 349 Node* node=dynamic_cast<Node*>(femmodel->nodes->GetObjectByOffset(i)); 350 if(node->InAnalysis(SeaiceAnalysisEnum)){ 351 if(serial_mask[node->Sid()]==1.){ 352 node->Activate(); 353 counter++; 354 } 355 else{ 356 node->Deactivate(); 357 } 358 } 359 } 360 xDelete<IssmDouble>(serial_mask); 361 362 /*Display number of active nodes*/ 363 int sum_counter; 364 ISSM_MPI_Reduce(&counter,&sum_counter,1,ISSM_MPI_INT,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 365 if(VerboseSolution()) _printf0_(" Number of active nodes: "<< sum_counter <<"\n"); 325 366 }/*}}}*/ 326 367 … … 422 463 xDelete<IssmDouble>(basis); 423 464 }/*}}}*/ 465 void SeaiceAnalysis::UpdateDamageAndStress(FemModel* femmodel){/*{{{*/ 466 /* The damage variable is updated as a function of the actual elastic deformation 467 * In both cases, a Coulombic enveloppe is used, define by the cohesion C, tan(phi) and tract_coef. 468 * In both cases, a maximal compressive strength is fixed at compr_max 469 * The enveloppe is defined in N/m^2. 470 * The coeficients of the internal stress are then multiplied by the ice thickness to be used in the vertical integrated momentiom equation. 471 */ 472 473 /* Mohr-Coulomb criterion calculation 474 * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 475 * 476 * sigma_s 477 * Mohr.Coulomb branch | 478 * \ | 479 * * | | 480 * * | cohesion (C=cfix+calea) 481 * | * | / 482 * | * | / tract 483 * | * |/ / 484 * -comp_max | * / 485 * \ | | * / 486 * \| 0| | * 487 * -------------------------*------------ sigma_n 488 * | | | * 489 * | | * 490 * | * 491 * | * | 492 * | * | 493 * | * | 494 * * | 495 * * | | 496 * * | 497 * | 498 * | 499 * 500 * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 501 */ 502 503 /*Intermediaties*/ 504 IssmDouble sigma_xx,sigma_yy,sigma_xy,sigma_s,sigma_n,sigma_target; 505 IssmDouble compression_coef,traction_coef,cohesion,tan_phi; 506 IssmDouble traction,compression_max; 507 IssmDouble damage_test,damage_new,damage,tmp; 508 509 /*Loop over the elements of this partition and update accordingly*/ 510 for(int i=0;i<femmodel->elements->Size();i++){ 511 Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i)); 512 513 /*Get Mohr-Coulomb parameters*/ 514 compression_coef = element->GetMaterialParameter(MaterialsCompressionCoefEnum); 515 traction_coef = element->GetMaterialParameter(MaterialsTractionCoefEnum); 516 cohesion = element->GetMaterialParameter(MaterialsCohesionEnum); //C 517 tan_phi = element->GetMaterialParameter(MaterialsInternalFrictionCoefEnum); //mu = tan(phi) 518 519 /*Get current stress state*/ 520 Input* sigma_xx_input = element->GetInput(StressTensorxxEnum); 521 Input* sigma_yy_input = element->GetInput(StressTensoryyEnum); 522 Input* sigma_xy_input = element->GetInput(StressTensorxyEnum); 523 if(sigma_xx_input) sigma_xx_input->GetInputAverage(&sigma_xx); 524 else sigma_xx = 0.; 525 if(sigma_yy_input) sigma_yy_input->GetInputAverage(&sigma_yy); 526 else sigma_yy = 0.; 527 if(sigma_xy_input) sigma_xy_input->GetInputAverage(&sigma_xy); 528 else sigma_xy = 0.; 529 530 /* Compute the invariants of the elastic deformation and instantaneous deformation rate */ 531 sigma_s=sqrt(pow((sigma_xx-sigma_yy)/2.,2)+pow(sigma_xy,2)); 532 sigma_n=(sigma_xx+sigma_yy)/2.; 533 534 /* same maximal tensile strength */ 535 traction=traction_coef*cohesion/tan_phi; 536 compression_max=compression_coef*cohesion; 537 538 /* estimate the internal constraints using the current elastic deformation */ 539 Input* damage_input = element->GetInput(MaterialsDamageEnum); _assert_(damage_input); 540 Input* damagenew_input = element->GetInput(MaterialsDamageEnum); _assert_(damagenew_input);//FIXME 541 damage_input->GetInputAverage(&damage); 542 damagenew_input->GetInputAverage(&damage_new); 543 damage_test = damage; 544 if(sigma_n>traction || sigma_n<-compression_max){ 545 if(sigma_n>traction){ 546 sigma_target=traction; 547 } 548 else{ 549 sigma_target=-compression_max; 550 } 551 552 tmp=1.-sigma_target/sigma_n*(1.-damage); 553 if(tmp<1. && tmp>damage_new){ 554 damage_test=((damage_test>tmp)?(damage_test):(tmp)); /* max(damage_test,tmp); */ 555 } 556 } 557 if(sigma_s>cohesion-sigma_n*tan_phi){ 558 tmp=1.0-cohesion/(sigma_s+sigma_n*tan_phi)*(1-damage); 559 if(tmp<1. && tmp>damage_new){ 560 damage_test=((damage_test>tmp)?(damage_test):(tmp)); /*max(damage_test,tmp); */ 561 } 562 } 563 564 /* The damage variable is changed */ 565 damage_new=damage_test; 566 element->AddInput(MaterialsDamageEnum,&damage_test,P0Enum);//FIXME 567 568 /* Recompute the internal stress*/ 569 if(damage<1.){ 570 sigma_xx = (1.-damage_new)/(1.-damage)*sigma_xx; 571 sigma_yy = (1.-damage_new)/(1.-damage)*sigma_yy; 572 sigma_xy = (1.-damage_new)/(1.-damage)*sigma_xy; 573 } 574 else{ 575 sigma_xx = 0.; 576 sigma_yy = 0.; 577 sigma_xy = 0.; 578 } 579 element->AddInput(StressTensorxxEnum,&sigma_xx,P0Enum); 580 element->AddInput(StressTensoryyEnum,&sigma_yy,P0Enum); 581 element->AddInput(StressTensorxyEnum,&sigma_xy,P0Enum); 582 } 583 }/*}}}*/ -
issm/trunk-jpl/src/c/analyses/SeaiceAnalysis.h
r18492 r18502 32 32 33 33 /*Sea ice specifics*/ 34 void UpdateDamageAndStress(FemModel* femmodel); 34 35 void CreateCTensor(IssmDouble* C,Element* element,Gauss* gauss); 35 36 void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss); -
issm/trunk-jpl/src/c/cores/seaice_core.cpp
r18492 r18502 18 18 femmodel->parameters->FindParam(&save_results,SaveResultsEnum); 19 19 20 if(VerboseSolution()) _printf0_("call computational core:\n");20 /*Launch solution sequence for the only analysis we are interested in*/ 21 21 femmodel->SetCurrentConfiguration(SeaiceAnalysisEnum); 22 22 solutionsequence_linear(femmodel);
Note:
See TracChangeset
for help on using the changeset viewer.