Changeset 13476


Ignore:
Timestamp:
09/28/12 13:33:15 (12 years ago)
Author:
cborstad
Message:

CHG: changed mechanicalproperties to sort eigenvalues in descending order by absolute value. Previously the first principal eigenalue was not guaranteed to have the greatest absolute value (as it should), a result of the way the eig() function in matlab sorts results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/mech/mechanicalproperties.m

    r13005 r13476  
    7676        %eigen values and vectors
    7777        [directions,value]=eig(stress);
     78        %sort by absolute value of eigenvalue in descending order
     79        [val,idx]=sort(abs(diag(value)),'descend');
     80        %re-order eigenvalues and associated vectors
     81        value=value(idx,idx);
     82        directions=directions(:,idx);
    7883        valuesstress(i,:)=[value(1,1) value(2,2)];
    7984        directionsstress(i,:)=directions(:)';
    8085        [directions,value]=eig(strain);
     86        %same for strainrate
     87        [val,idx]=sort(abs(diag(value)),'descend');
     88        value=value(idx,idx);
     89        directions=directions(:,idx);
    8190        valuesstrain(i,:)=[value(1,1) value(2,2)];
    8291        directionsstrain(i,:)=directions(:)';
     
    8998stress.yy=tau_yy;
    9099stress.xy=tau_xy;
    91 stress.principalvalue2=valuesstress(:,1);
    92 stress.principalaxis2=directionsstress(:,1:2);
    93 stress.principalvalue1=valuesstress(:,2);
    94 stress.principalaxis1=directionsstress(:,3:4);
     100stress.principalvalue1=valuesstress(:,1);
     101stress.principalaxis1=directionsstress(:,1:2);
     102stress.principalvalue2=valuesstress(:,2);
     103stress.principalaxis2=directionsstress(:,3:4);
    95104stress.effectivevalue=1/sqrt(2)*sqrt(stress.xx.^2+stress.yy.^2+2*stress.xy.^2);
    96105md.results.stress=stress;
     
    100109strainrate.yy=vy;
    101110strainrate.xy=uyvx;
    102 strainrate.principalvalue2=valuesstrain(:,1)*(365.25*24*3600); %strain rate in 1/a instead of 1/s
    103 strainrate.principalaxis2=directionsstrain(:,1:2);
    104 strainrate.principalvalue1=valuesstrain(:,2)*(365.25*24*3600); %strain rate in 1/a instead of 1/s
    105 strainrate.principalaxis1=directionsstrain(:,3:4);
     111strainrate.principalvalue1=valuesstrain(:,1)*(365.25*24*3600); %strain rate in 1/a instead of 1/s
     112strainrate.principalaxis1=directionsstrain(:,1:2);
     113strainrate.principalvalue2=valuesstrain(:,2)*(365.25*24*3600); %strain rate in 1/a instead of 1/s
     114strainrate.principalaxis2=directionsstrain(:,3:4);
    106115strainrate.effectivevalue=1/sqrt(2)*sqrt(strainrate.xx.^2+strainrate.yy.^2+2*strainrate.xy.^2);
    107116md.results.strainrate=strainrate;
     
    111120deviatoricstress.yy=tau_yy;
    112121deviatoricstress.xy=tau_xy;
    113 deviatoricstress.principalvalue2=valuesstress(:,1);
    114 deviatoricstress.principalaxis2=directionsstress(:,1:2);
    115 deviatoricstress.principalvalue1=valuesstress(:,2);
    116 deviatoricstress.principalaxis1=directionsstress(:,3:4);
     122deviatoricstress.principalvalue1=valuesstress(:,1);
     123deviatoricstress.principalaxis1=directionsstress(:,1:2);
     124deviatoricstress.principalvalue2=valuesstress(:,2);
     125deviatoricstress.principalaxis2=directionsstress(:,3:4);
    117126deviatoricstress.effectivevalue=1/sqrt(2)*sqrt(stress.xx.^2+stress.yy.^2+2*stress.xy.^2);
    118127md.results.deviatoricstress=deviatoricstress;
Note: See TracChangeset for help on using the changeset viewer.