Changeset 23977


Ignore:
Timestamp:
05/31/19 20:03:07 (6 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixed a few things...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/classes/Loads/Channel.cpp

    r23973 r23977  
    381381        Input* n_input      = element->GetInput(MaterialsRheologyNEnum);         _assert_(n_input);
    382382        Input* ks_input     = element->GetInput(HydrologySheetConductivityEnum); _assert_(ks_input);
    383         Input* phiold_input = element->GetInput(HydraulicPotentialOldEnum);      _assert_(phiold_input);
    384383        Input* phi_input    = element->GetInput(HydraulicPotentialEnum);         _assert_(phi_input);
    385384
     
    402401
    403402                /*Get input values at gauss points*/
     403                phi_input->GetInputDerivativeValue(&dphi[0],&xyz_list_tria[0][0],gauss);
     404                b_input->GetInputDerivativeValue(&db[0],&xyz_list_tria[0][0],gauss);
    404405                phi_input->GetInputValue(&phi,gauss);
    405                 phi_input->GetInputDerivativeValue(&dphi[0],&xyz_list_tria[0][0],gauss);
    406406                h_input->GetInputValue(&h,gauss);
    407407                ks_input->GetInputValue(&ks,gauss);
     
    409409                n_input->GetInputValue(&n,gauss);
    410410                b_input->GetInputValue(&b,gauss);
    411                 b_input->GetInputDerivativeValue(&db[0],&xyz_list_tria[0][0],gauss);
    412411                H_input->GetInputValue(&H,gauss);
    413412
     
    484483        /*Intermediaries */
    485484        IssmDouble  Jdet,v2,Afactor,Bfactor,fFactor;
    486         IssmDouble  A,B,n,phi_old,phi,phi_0,dphimds;
    487         IssmDouble  H,h,b,db[2],dphids,qc,dPw,ks;
     485        IssmDouble  A,B,n,phi_old,phi,phi_0,dphimds,dphi[2];
     486        IssmDouble  H,h,b,db[2],dphids,qc,dPw,ks,Ngrad;
    488487        IssmDouble  xyz_list[NUMVERTICES][3];
    489488        IssmDouble  xyz_list_tria[3][3];
     
    512511        Input* n_input      = element->GetInput(MaterialsRheologyNEnum);         _assert_(n_input);
    513512        Input* ks_input     = element->GetInput(HydrologySheetConductivityEnum); _assert_(ks_input);
    514         Input* phiold_input = element->GetInput(HydraulicPotentialOldEnum);      _assert_(phiold_input);
    515513        Input* phi_input    = element->GetInput(HydraulicPotentialEnum);         _assert_(phi_input);
    516514
     
    531529                /*Get input values at gauss points*/
    532530                b_input->GetInputDerivativeValue(&db[0],&xyz_list_tria[0][0],gauss);
     531                phi_input->GetInputDerivativeValue(&dphi[0],&xyz_list_tria[0][0],gauss);
    533532                h_input->GetInputValue(&h,gauss);
    534533                ks_input->GetInputValue(&ks,gauss);
     
    540539
    541540                /*Get values for a few potentials*/
     541                phi_0   = rho_water*g*b + rho_ice*g*H;
     542                dphids  = dphi[0]*tx + dphi[1]*ty;
    542543                dphimds = rho_water*g*(db[0]*tx + db[1]*ty);
     544                Ngrad   = fabs(dphids);
     545                if(Ngrad<1.e-12) Ngrad = 1.e-12;
    543546
    544547                /*Compute the effective conductivity Kc = k h^alpha |grad Phi|^{beta-2} (same for sheet)*/
    545                 IssmDouble Kc = kc * pow(this->S,ALPHA_C) * pow(fabs(dphids),BETA_C-2.);
    546                 IssmDouble Ks = ks * pow(h      ,ALPHA_S) * pow(fabs(dphids),BETA_S-2.);
     548                IssmDouble Kc = kc * pow(this->S,ALPHA_C) * pow(Ngrad,BETA_C-2.);
     549                IssmDouble Ks = ks * pow(h      ,ALPHA_S) * pow(Ngrad,BETA_S-2.);
    547550
    548551                /*Approx. discharge in the sheet flowing folwing in the direction of the channel ofver a width lc*/
     
    564567                /*Compute closing rate*/
    565568                /*See Gagliardini and Werder 2018 eq. A2 (v = v2(phi_i) + v1*phi_{i+1})*/
    566                 phi_0 = rho_water*g*b + rho_ice*g*H;
    567569                A=pow(B,-n);
    568570                v2 = 2./pow(n,n)*A*this->S*(pow(fabs(phi_0 - phi),n-1.)*(phi_0 +(n-1.)*phi));
     
    616618        Input* n_input      = element->GetInput(MaterialsRheologyNEnum);         _assert_(n_input);
    617619        Input* ks_input     = element->GetInput(HydrologySheetConductivityEnum); _assert_(ks_input);
    618         Input* phiold_input = element->GetInput(HydraulicPotentialOldEnum);      _assert_(phiold_input);
    619620        Input* phi_input    = element->GetInput(HydraulicPotentialEnum);         _assert_(phi_input);
    620621
     
    676677        /*Compute new S based on Forward Euler (explicit)*/
    677678        this->S = this->S + dt*( (Xi - Pi)/(rho_ice*L) - vc);
    678         if(this->S<0); this->S = 0.;
     679        if(this->S<0.); this->S = 0.;
    679680
    680681        /*Clean up and return*/
Note: See TracChangeset for help on using the changeset viewer.