Changeset 11373
- Timestamp:
- 02/08/12 16:49:03 (13 years ago)
- Location:
- issm/trunk-jpl-damage/src/c/objects/Materials
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl-damage/src/c/objects/Materials/Matice.cpp
r11291 r11373 218 218 } 219 219 /*}}}*/ 220 /*FUNCTION Matice::GetZ {{{1*/ 221 double Matice::GetZ(){ 222 223 /*Output*/ 224 double Z; 225 226 inputs->GetInputAverage(&Z,MaterialsRheologyZEnum); 227 return Z; 228 } 229 /*}}}*/ 230 /*FUNCTION Matice::GetZbar {{{1*/ 231 double Matice::GetZbar(){ 232 233 /*Output*/ 234 double Zbar; 235 236 inputs->GetInputAverage(&Zbar,MaterialsRheologyZbarEnum); 237 return Zbar; 238 } 239 /*}}}*/ 220 240 /*FUNCTION Matice::GetN {{{1*/ 221 241 double Matice::GetN(){ … … 263 283 void Matice::GetViscosity2d(double* pviscosity, double* epsilon){ 264 284 /*From a string tensor and a material object, return viscosity, using Glen's flow law. 265 285 Z * B 266 286 viscosity= ------------------------------------------------------------------- 267 287 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] 268 288 269 where viscosity is the visco tiy, B the flow law parameter , (u,v) the velocity270 vector, and n the flow law exponent.289 where viscosity is the viscosity, Z the damage effect variable (1-D), 290 B the flow law parameter, (u,v) the velocity vector, and n the flow law exponent. 271 291 272 292 If epsilon is NULL, it means this is the first time SystemMatrices is being run, and we … … 282 302 /*Intermediary: */ 283 303 double A,e; 284 double B,n; 285 286 /*Get B and n*/ 287 B=GetBbar(); 304 double Btmp,B,n,Z; 305 306 /*Get B, Z and n*/ 307 Btmp=GetBbar(); 308 Z=GetZbar(); 288 309 n=GetN(); 310 B=Z*Btmp; 289 311 290 312 if (n==1){ … … 318 340 if(viscosity<=0) _error_("Negative viscosity"); 319 341 _assert_(B>0); 342 _assert_(Z>0); 320 343 _assert_(n>0); 321 344 … … 329 352 /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: 330 353 * 331 * 354 * Z * B 332 355 * viscosity3d= ------------------------------------------------------------------- 333 356 * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] … … 348 371 /*Intermediaries: */ 349 372 double A,e; 350 double B ,n;373 double Btmp,B,n,Z; 351 374 352 375 /*Get B and n*/ 353 B=GetB(); 376 Btmp=GetB(); 377 Z=GetZ(); 354 378 n=GetN(); 379 B=Z*Btmp; 355 380 356 381 if (n==1){ … … 389 414 if(viscosity3d<=0) _error_("Negative viscosity"); 390 415 _assert_(B>0); 416 _assert_(Z>0); 391 417 _assert_(n>0); 392 418 … … 399 425 /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: 400 426 * 401 * 427 * Z * B 402 428 * viscosity3d= ------------------------------------------------------------------- 403 429 * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] … … 418 444 /*Intermediaries: */ 419 445 double A,e; 420 double B ,n;446 double Btmp,B,Z,n; 421 447 double eps0; 422 448 423 449 /*Get B and n*/ 424 450 eps0=pow((double)10,(double)-27); 425 B=GetB(); 426 n=GetN(); 451 Btmp=GetB(); 452 Z=GetZ(); 453 n=GetB(); 454 B=Z*Btmp; 427 455 428 456 if (n==1){ … … 461 489 if(viscosity3d<=0) _error_("Negative viscosity"); 462 490 _assert_(B>0); 491 _assert_(Z>0); 463 492 _assert_(n>0); 464 493 … … 490 519 491 520 /*Get B and n*/ 492 B=GetBbar(); 521 B=GetBbar(); /* why is this needed in this function? */ 493 522 n=GetN(); 494 523 … … 508 537 509 538 viscosity_complement=1/(2*pow(A,e)); 539 } 540 } 541 else{ 542 viscosity_complement=4.5*pow((double)10,(double)17); 543 } 544 545 /*Checks in debugging mode*/ 546 _assert_(B>0); /* shouldn't be necessary as B is never used! */ 547 _assert_(n>0); 548 _assert_(viscosity_complement>0); 549 550 /*Return: */ 551 *pviscosity_complement=viscosity_complement; 552 } 553 /*}}}*/ 554 /*FUNCTION Matice::GetViscosityZComplement {{{1*/ 555 void Matice::GetViscosityZComplement(double* pviscosity_complement, double* epsilon){ 556 /*Return viscosity derivative for control method d(mu)/dZ: 557 * 558 * B 559 * dviscosity= ------------------------------------------------------------------- 560 * 2[ exx^2+eyy^2+exx*eyy+exy^2+exz^2+eyz^2 ]^[(n-1)/2n] 561 * 562 * If epsilon is NULL, it means this is the first time Gradjb is being run, and we 563 * return mu20, initial viscosity. 564 */ 565 566 /*output: */ 567 double viscosity_complement; 568 569 /*input strain rate: */ 570 double exx,eyy,exy; 571 572 /*Intermediary value A and exponent e: */ 573 double A,e; 574 double B,n; 575 576 /*Get B and n*/ 577 B=GetBbar(); 578 n=GetN(); 579 580 if(epsilon){ 581 exx=*(epsilon+0); 582 eyy=*(epsilon+1); 583 exy=*(epsilon+2); 584 585 /*Build viscosity: mu2=B/(2*A^e) */ 586 A=pow(exx,2)+pow(eyy,2)+pow(exy,2)+exx*eyy; 587 if(A==0){ 588 /*Maximum viscosity_complement for 0 shear areas: */ 589 viscosity_complement=2.25*pow((double)10,(double)17); 590 } 591 else{ 592 e=(n-1)/(2*n); 593 594 viscosity_complement=B/(2*pow(A,e)); 510 595 } 511 596 } … … 685 770 this->inputs->AddInput(new TriaP1Input(MaterialsRheologyBbarEnum,nodeinputs)); 686 771 } 772 773 /*Get Z*/ 774 if (iomodel->Data(MaterialsRheologyZEnum)) { 775 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyZEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; 776 this->inputs->AddInput(new TriaP1Input(MaterialsRheologyZbarEnum,nodeinputs)); 777 } 687 778 688 779 /*Get n*/ … … 706 797 } 707 798 break; 799 case MaterialsRheologyZbarEnum: 800 if (iomodel->Data(MaterialsRheologyZEnum)){ 801 _assert_(iomodel->Data(MaterialsRheologyZEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); 802 for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(MaterialsRheologyZEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; 803 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; 804 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; 805 this->inputs->AddInput(new ControlInput(MaterialsRheologyZbarEnum,TriaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 806 } 807 break; 708 808 } 709 809 } … … 726 826 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; 727 827 this->inputs->AddInput(new PentaP1Input(MaterialsRheologyBEnum,nodeinputs)); 828 } 829 830 /*Get Z*/ 831 if (iomodel->Data(MaterialsRheologyZEnum)) { 832 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyZEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+i]-1)]; 833 this->inputs->AddInput(new PentaP1Input(MaterialsRheologyZEnum,nodeinputs)); 728 834 } 729 835 … … 748 854 } 749 855 break; 856 case MaterialsRheologyZbarEnum: 857 if (iomodel->Data(MaterialsRheologyZEnum)){ 858 _assert_(iomodel->Data(MaterialsRheologyZEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum)); 859 for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(MaterialsRheologyZEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)]; 860 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; 861 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[int(iomodel->Data(MeshElementsEnum)[num_vertices*index+j]-1)*num_control_type+i]; 862 this->inputs->AddInput(new ControlInput(MaterialsRheologyZbarEnum,PentaP1InputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 863 } 864 break; 865 750 866 } 751 867 } … … 766 882 name==MaterialsRheologyBEnum || 767 883 name==MaterialsRheologyBbarEnum || 884 name==MaterialsRheologyZEnum || 885 name==MaterialsRheologyZbarEnum || 768 886 name==MaterialsRheologyNEnum 769 887 ){ -
issm/trunk-jpl-damage/src/c/objects/Materials/Matice.h
r10576 r11373 68 68 void GetViscosity3dStokes(double* pviscosity3d, double* epsilon); 69 69 void GetViscosityComplement(double* pviscosity_complement, double* pepsilon); 70 void GetViscosityZComplement(double* pviscosity_complement, double* pepsilon); 70 71 double GetB(); 71 72 double GetBbar(); 73 double GetZ(); 74 double GetZbar(); 72 75 double GetN(); 73 76 bool IsInput(int name);
Note:
See TracChangeset
for help on using the changeset viewer.