Changeset 17093


Ignore:
Timestamp:
01/10/14 13:28:59 (11 years ago)
Author:
Mathieu Morlighem
Message:

CHG: simplifying strain rate computation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Element.cpp

    r16947 r17093  
    413413         */
    414414
    415         IssmDouble epsilonvx[6];
    416         IssmDouble epsilonvy[6];
    417         IssmDouble epsilonvz[6];
     415        /*Intermediaries*/
     416        IssmDouble dvx[3];
     417        IssmDouble dvy[3];
     418        IssmDouble dvz[3];
    418419
    419420        /*Check that both inputs have been found*/
     
    423424
    424425        /*Get strain rate assuming that epsilon has been allocated*/
    425         vx_input->GetVxStrainRate3d(epsilonvx,xyz_list,gauss);
    426         vy_input->GetVyStrainRate3d(epsilonvy,xyz_list,gauss);
    427         vz_input->GetVzStrainRate3d(epsilonvz,xyz_list,gauss);
    428 
    429         /*Sum all contributions*/
    430         for(int i=0;i<6;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i]+epsilonvz[i];
     426        vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
     427        vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
     428        vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
     429        epsilon[0] = dvx[0];
     430        epsilon[1] = dvy[1];
     431        epsilon[2] = dvz[2];
     432        epsilon[3] = 0.5*(dvx[1] + dvy[0]);
     433        epsilon[4] = 0.5*(dvx[2] + dvz[0]);
     434        epsilon[5] = 0.5*(dvy[2] + dvz[1]);
     435
    431436}/*}}}*/
    432437void Element::StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
     
    441446         */
    442447
    443         int i;
    444         IssmDouble epsilonvx[5];
    445         IssmDouble epsilonvy[5];
     448        /*Intermediaries*/
     449        IssmDouble dvx[3];
     450        IssmDouble dvy[3];
    446451
    447452        /*Check that both inputs have been found*/
     
    451456
    452457        /*Get strain rate assuming that epsilon has been allocated*/
    453         vx_input->GetVxStrainRate3dHO(epsilonvx,xyz_list,gauss);
    454         vy_input->GetVyStrainRate3dHO(epsilonvy,xyz_list,gauss);
    455 
    456         /*Sum all contributions*/
    457         for(i=0;i<5;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
     458        vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
     459        vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
     460        epsilon[0] = dvx[0];
     461        epsilon[1] = dvy[1];
     462        epsilon[2] = 0.5*(dvx[1] + dvy[0]);
     463        epsilon[3] = 0.5*dvx[2];
     464        epsilon[4] = 0.5*dvy[2];
     465
    458466}/*}}}*/
    459467void Element::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
    460468
    461         int i;
    462         IssmDouble epsilonvx[3];
    463         IssmDouble epsilonvy[3];
     469        /*Intermediaries*/
     470        IssmDouble dvx[3];
     471        IssmDouble dvy[3];
    464472
    465473        /*Check that both inputs have been found*/
     
    469477
    470478        /*Get strain rate assuming that epsilon has been allocated*/
    471         vx_input->GetVxStrainRate2d(epsilonvx,xyz_list,gauss);
    472         vy_input->GetVyStrainRate2d(epsilonvy,xyz_list,gauss);
    473 
    474         /*Sum all contributions*/
    475         for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
     479        vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
     480        vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
     481        epsilon[0] = dvx[0];
     482        epsilon[1] = dvy[1];
     483        epsilon[2] = 0.5*(dvx[1] + dvy[0]);
     484
    476485}/*}}}*/
    477486void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
Note: See TracChangeset for help on using the changeset viewer.