Changeset 23963
- Timestamp:
- 05/30/19 14:53:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Loads/Channel.cpp
r23962 r23963 14 14 #include "../classes.h" 15 15 /*}}}*/ 16 17 /*Macros*/ 16 18 #define NUMNODES 2 17 19 #define NUMVERTICES 2 20 21 #define C_W 4.22e3 /*specific heat capacity of water (J/kg/K)*/ 22 #define ALPHA_C 5./4. 23 #define BETA_C 3./2. 24 /*Make sure these are the same as in HydrologyGlaDSAnalysis::CreateKMatrix*/ 25 #define ALPHA_S 5./4. 26 #define BETA_S 3./2. 18 27 19 28 /*Channel constructors and destructor*/ … … 338 347 339 348 /*Intermediaries */ 340 IssmDouble Jdet,v1 ;341 IssmDouble A,B,n,phi_old,phi,phi_0 ;342 IssmDouble H,h,b ;349 IssmDouble Jdet,v1,qc,fFactor; 350 IssmDouble A,B,n,phi_old,phi,phi_0,dPw; 351 IssmDouble H,h,b,dphi[2],dphids,dphimds,db[2],dbds; 343 352 IssmDouble xyz_list[NUMVERTICES][3]; 344 353 IssmDouble xyz_list_tria[3][3]; … … 354 363 GetVerticesCoordinates(&xyz_list[0][0] ,this->vertices,NUMVERTICES); 355 364 GetVerticesCoordinates(&xyz_list_tria[0][0],tria->vertices,3); 365 356 366 IssmDouble L = element->FindParam(MaterialsLatentheatEnum); 357 367 IssmDouble rho_ice = element->FindParam(MaterialsRhoIceEnum); … … 359 369 IssmDouble dt = element->FindParam(TimesteppingTimeStepEnum); 360 370 IssmDouble g = element->FindParam(ConstantsGEnum); 371 IssmDouble kc = element->FindParam(HydrologyChannelConductivityEnum); 372 IssmDouble ks = element->FindParam(HydrologySheetConductivityEnum); 373 IssmDouble lc = element->FindParam(HydrologyChannelSheetWidthEnum); 374 IssmDouble c_t = element->FindParam(HydrologyPressureMeltCoefficientEnum); 375 361 376 Input* h_input = element->GetInput(HydrologySheetThicknessEnum);_assert_(h_input); 362 377 Input* H_input = element->GetInput(ThicknessEnum); _assert_(H_input); … … 381 396 tria->GetSegmentNodalFunctions(&basis[0],gauss,index1,index2,tria->FiniteElement()); 382 397 tria->GetSegmentNodalFunctionsDerivatives(&dbasisdx[0],&xyz_list_tria[0][0],gauss,index1,index2,tria->FiniteElement()); 398 dbasisds[0] = dbasisdx[0*2+0]*tx + dbasisdx[0*2+1]*ty; 399 dbasisds[1] = dbasisdx[1*2+0]*tx + dbasisdx[1*2+1]*ty; 383 400 384 401 /*Get input values at gauss points*/ 402 phi_input->GetInputValue(&phi,gauss); 403 phi_input->GetInputDerivativeValue(&dphi[0],&xyz_list_tria[0][0],gauss); 385 404 h_input->GetInputValue(&h,gauss); 386 405 B_input->GetInputValue(&B,gauss); 387 406 n_input->GetInputValue(&n,gauss); 388 phi_input->GetInputValue(&phi,gauss);389 407 b_input->GetInputValue(&b,gauss); 408 b_input->GetInputDerivativeValue(&db[0],&xyz_list_tria[0][0],gauss); 390 409 H_input->GetInputValue(&H,gauss); 391 410 411 /*Get values for a few potentials*/ 412 phi_0 = rho_water*g*b + rho_ice*g*H; 413 dphids = dphi[0]*tx + dphi[1]*ty; 414 dphimds = rho_water*g*(db[0]*tx + db[1]*ty); 415 416 /*Compute the effective conductivity Kc = k h^alpha |grad Phi|^{beta-2} (same for sheet)*/ 417 IssmDouble Kc = kc * pow(this->S,ALPHA_C) * pow(fabs(dphids),BETA_C-2.); 418 IssmDouble Ks = ks * pow(h ,ALPHA_S) * pow(fabs(dphids),BETA_S-2.); 419 420 /*Approx. discharge in the sheet flowing folwing in the direction of the channel ofver a width lc*/ 421 qc = - Ks * dphids; 422 423 /*d(phi - phi_m)/ds*/ 424 dPw = dphids - dphimds; 425 426 /*Compute f factor*/ 427 fFactor = 0.; 428 if(this->S>0. || qc*dPw>0.){ 429 fFactor = lc * qc; 430 } 431 432 /*Diffusive term*/ 433 for(int i=0;i<numnodes;i++){ 434 for(int j=0;j<numnodes;j++){ 435 Ke->values[i*numnodes+j] += gauss->weight*Jdet*( 436 +Kc*dbasisds[i]*dbasisds[j] /*GlaDSCoupledSolver.F90 line 1659*/ 437 ); 438 } 439 } 440 392 441 /*Closing rate term, see Gagliardini and Werder 2018 eq. A2 (v = v1*phi_i + v2(phi_{i+1}))*/ 393 phi_0 = rho_water*g*b + rho_ice*g*H;394 442 A=pow(B,-n); 395 443 v1 = 2./pow(n,n)*A*S*(pow(fabs(phi_0 - phi),n-1.)*( - n));
Note:
See TracChangeset
for help on using the changeset viewer.