Changeset 23964
- Timestamp:
- 05/30/19 15:30:59 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Loads/Channel.cpp
r23963 r23964 347 347 348 348 /*Intermediaries */ 349 IssmDouble Jdet,v1,qc,fFactor ;349 IssmDouble Jdet,v1,qc,fFactor,Afactor,Bfactor,Xifactor; 350 350 IssmDouble A,B,n,phi_old,phi,phi_0,dPw; 351 351 IssmDouble H,h,b,dphi[2],dphids,dphimds,db[2],dbds; … … 367 367 IssmDouble rho_ice = element->FindParam(MaterialsRhoIceEnum); 368 368 IssmDouble rho_water = element->FindParam(MaterialsRhoFreshwaterEnum); 369 IssmDouble dt = element->FindParam(TimesteppingTimeStepEnum);370 369 IssmDouble g = element->FindParam(ConstantsGEnum); 371 370 IssmDouble kc = element->FindParam(HydrologyChannelConductivityEnum); … … 430 429 } 431 430 431 /*Compute Afactor and Bfactor*/ 432 Afactor = C_W*c_t*rho_water; 433 Bfactor = 1./L * (1./rho_ice - 1./rho_water); 434 if(dphids>0){ 435 Xifactor = + Bfactor * (fabs(-Kc*dphids) + fabs(lc*qc)); 436 } 437 else{ 438 Xifactor = - Bfactor * (fabs(-Kc*dphids) + fabs(lc*qc)); 439 } 440 432 441 /*Diffusive term*/ 433 442 for(int i=0;i<numnodes;i++){ 434 443 for(int j=0;j<numnodes;j++){ 444 /*GlaDSCoupledSolver.F90 line 1659*/ 435 445 Ke->values[i*numnodes+j] += gauss->weight*Jdet*( 436 +Kc*dbasisds[i]*dbasisds[j] /*GlaDSCoupledSolver.F90 line 1659*/ 446 +Kc*dbasisds[i]*dbasisds[j] /*Diffusion term*/ 447 - Afactor * Bfactor* Kc * dPw * basis[i] * dbasisds[j] /*First part of Pi*/ 448 + Afactor * fFactor * Bfactor * basis[i] * dbasisds[j] /*Second part of Pi*/ 449 + Xifactor* basis[i] * dbasisds[j] /*Xi term*/ 437 450 ); 438 451 } … … 447 460 } 448 461 } 449 450 /*Transient term if dt>0*/451 if(dt>0.){452 }453 462 } 454 463 … … 468 477 469 478 /*Intermediaries */ 470 IssmDouble Jdet,v2 ;471 IssmDouble A,B,n,phi_old,phi,phi_0 ;472 IssmDouble H,h,b ;479 IssmDouble Jdet,v2,Afactor,Bfactor,fFactor; 480 IssmDouble A,B,n,phi_old,phi,phi_0,dphimds; 481 IssmDouble H,h,b,db[2],dphids,qc,dPw; 473 482 IssmDouble xyz_list[NUMVERTICES][3]; 483 IssmDouble xyz_list_tria[3][3]; 474 484 const int numnodes = NUMNODES; 475 485 … … 480 490 /*Retrieve all inputs and parameters*/ 481 491 GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES); 492 GetVerticesCoordinates(&xyz_list_tria[0][0],tria->vertices,3); 493 482 494 IssmDouble L = element->FindParam(MaterialsLatentheatEnum); 483 495 IssmDouble rho_ice = element->FindParam(MaterialsRhoIceEnum); 484 496 IssmDouble rho_water = element->FindParam(MaterialsRhoFreshwaterEnum); 485 IssmDouble dt = element->FindParam(TimesteppingTimeStepEnum); 497 IssmDouble kc = element->FindParam(HydrologyChannelConductivityEnum); 498 IssmDouble ks = element->FindParam(HydrologySheetConductivityEnum); 486 499 IssmDouble g = element->FindParam(ConstantsGEnum); 500 IssmDouble lc = element->FindParam(HydrologyChannelSheetWidthEnum); 501 IssmDouble c_t = element->FindParam(HydrologyPressureMeltCoefficientEnum); 502 487 503 Input* h_input = element->GetInput(HydrologySheetThicknessEnum);_assert_(h_input); 488 504 Input* H_input = element->GetInput(ThicknessEnum); _assert_(H_input); … … 493 509 Input* phi_input = element->GetInput(HydraulicPotentialEnum); _assert_(phi_input); 494 510 511 /*Get tangent vector*/ 512 IssmDouble tx = xyz_list_tria[index2][0] - xyz_list_tria[index1][0]; 513 IssmDouble ty = xyz_list_tria[index2][1] - xyz_list_tria[index1][1]; 514 tx = tx/sqrt(tx*tx+ty*ty); 515 ty = ty/sqrt(tx*tx+ty*ty); 516 495 517 /* Start looping on the number of gaussian points: */ 496 518 Gauss* gauss=new GaussTria(index1,index2,2); … … 502 524 503 525 /*Get input values at gauss points*/ 526 b_input->GetInputDerivativeValue(&db[0],&xyz_list_tria[0][0],gauss); 504 527 h_input->GetInputValue(&h,gauss); 505 528 B_input->GetInputValue(&B,gauss); … … 509 532 H_input->GetInputValue(&H,gauss); 510 533 534 /*Get values for a few potentials*/ 535 dphimds = rho_water*g*(db[0]*tx + db[1]*ty); 536 537 /*Compute the effective conductivity Kc = k h^alpha |grad Phi|^{beta-2} (same for sheet)*/ 538 IssmDouble Kc = kc * pow(this->S,ALPHA_C) * pow(fabs(dphids),BETA_C-2.); 539 IssmDouble Ks = ks * pow(h ,ALPHA_S) * pow(fabs(dphids),BETA_S-2.); 540 541 /*Approx. discharge in the sheet flowing folwing in the direction of the channel ofver a width lc*/ 542 qc = - Ks * dphids; 543 544 /*d(phi - phi_m)/ds*/ 545 dPw = dphids - dphimds; 546 547 /*Compute f factor*/ 548 fFactor = 0.; 549 if(this->S>0. || qc*dPw>0.){ 550 fFactor = lc * qc; 551 } 552 553 /*Compute Afactor and Bfactor*/ 554 Afactor = C_W*c_t*rho_water; 555 Bfactor = 1./L * (1./rho_ice - 1./rho_water); 556 511 557 /*Compute closing rate*/ 512 558 /*See Gagliardini and Werder 2018 eq. A2 (v = v2(phi_i) + v1*phi_{i+1})*/ … … 515 561 v2 = 2./pow(n,n)*A*this->S*(pow(fabs(phi_0 - phi),n-1.)*(phi_0 +(n-1.)*phi)); 516 562 517 for(int i=0;i<numnodes;i++) pe->values[i]+= - Jdet*gauss->weight*(-v2)*basis[i]; 518 519 /*Transient term if dt>0*/ 520 if(dt>0.){ 521 //phiold_input->GetInputValue(&phi_old,gauss); 522 //for(int i=0;i<numnodes;i++) pe->values[i] += gauss->weight*Jdet*e_v/(rho_water*g*dt)*phi_old*basis[i]; 563 for(int i=0;i<numnodes;i++){ 564 pe->values[i]+= - Jdet*gauss->weight*(-v2)*basis[i]; 565 pe->values[i]+= + Jdet*gauss->weight*Afactor*Bfactor*fFactor*dphimds*basis[i]; 523 566 } 524 567 }
Note:
See TracChangeset
for help on using the changeset viewer.