Changeset 1236


Ignore:
Timestamp:
07/06/09 11:12:27 (15 years ago)
Author:
Mathieu Morlighem
Message:

use GetNodalFunctionsCoeff and GetArea now

Location:
issm/trunk/src/m/classes/public
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/averaging.m

    r1 r1236  
    2222%initialization
    2323weights=zeros(md.numberofgrids,1);
    24 areas=zeros(md.numberofelements,1);
    2524data=data(:);
    2625
     
    3433if strcmpi(md.type,'3d')
    3534        rep=6;
     35        areas=Getareas(index,md.x,md.y,md.z);
    3636else
    3737        rep=3;
     38        areas=Getareas(index,md.x,md.y);
    3839end
    3940summation=1/rep*ones(rep,1);
    4041linesize=rep*numberofelements;
    41 
    42 %compute the volume of each element
    43 areas=area(md);
    4442
    4543%update weights that holds the volume of all the element holding the grid i
  • issm/trunk/src/m/classes/public/mechanicalproperties.m

    r631 r1236  
    2828index=md.elements;
    2929summation=[1;1;1];
    30 alpha=zeros(numberofelements,3);
    31 beta=zeros(numberofelements,3);
    32 %gamma=zeros(numberofelements,3);
    3330directionsstress=zeros(numberofelements,4);
    3431directionsstrain=zeros(numberofelements,4);
     
    3734
    3835%compute nodal functions coefficients N(x,y)=alpha x + beta y +gamma
    39 x1=md.x(index(:,1)); x2=md.x(index(:,2)); x3=md.x(index(:,3));
    40 y1=md.y(index(:,1)); y2=md.y(index(:,2)); y3=md.y(index(:,3));
    41 invdet=1./(x1.*(y2-y3)-x2.*(y1-y3)+x3.*(y1-y2));
    42 alpha=[invdet.*(y2-y3) invdet.*(y3-y1) invdet.*(y1-y2)];
    43 beta =[invdet.*(x3-x2) invdet.*(x1-x3) invdet.*(x2-x1)];
    44 %gamma=[invdet.*(x2.*y3-x3.*y2) invdet.*(y1.*x3-y3.*x1) invdet.*(x1.*y2-x2.*y1)];
    45 clear invdet x1 x2 x3 y1 y2 y3
     36[alpha beta]=GetNodalFunctionsCoeff(index,md.x,md.y);
    4637
    4738%compute shear
  • issm/trunk/src/m/classes/public/mesh/meshadaptation.m

    r1214 r1236  
    2222disp(sprintf('      metric computation') )
    2323
    24 %load some variables (it is much faster if the variab;es are loaded from md once for all)
     24%initialization
     25index=md.elements;
     26numberofgrids=md.numberofgrids;
    2527numberofelements=md.numberofelements;
    26 numberofgrids=md.numberofgrids;
    27 index=md.elements;
    28 x=md.x; y=md.y; z=md.z;
    29 
    30 %initialization
    31 alpha=zeros(md.numberofelements,3);
    32 beta=zeros(md.numberofelements,3);
    33 gradx=zeros(md.numberofgrids,1);
    34 grady=zeros(md.numberofgrids,1);
    35 metric=zeros(md.numberofelements,1);
     28gradx=zeros(numberofgrids,1);
     29grady=zeros(numberofgrids,1);
     30metric=zeros(numberofelements,1);
    3631
    3732%build some usefull variables
     
    4035summation=1/3*ones(3,1);
    4136linesize=3*numberofelements;
    42 x1=x(index(:,1)); x2=x(index(:,2)); x3=x(index(:,3)); y1=y(index(:,1)); y2=y(index(:,2)); y3=y(index(:,3));
    4337
    44 %compute nodal functions coefficients N(x,y)=alpha x + beta y + gamma
    45 invdet=1./(x1.*(y2-y3)-x2.*(y1-y3)+x3.*(y1-y2));
    46 alpha=[invdet.*(y2-y3) invdet.*(y3-y1) invdet.*(y1-y2)];
    47 beta=[invdet.*(x3-x2) invdet.*(x1-x3) invdet.*(x2-x1)];
     38%get areas and  nodal functions coefficients N(x,y)=alpha x + beta y + gamma
     39[alpha beta]=GetNodalFunctionsCoeff(index,md.x,md.y);
     40areas=Getareas(index,md.x,md.y);
    4841
    4942%Compute gradient for each element
    5043grad_elx=sum(field(index).*alpha,2);
    5144grad_ely=sum(field(index).*beta,2);
    52 
    53 %compute the volume of each element
    54 areas=area(md);
    5545
    5646%update weights that holds the volume of all the element holding the grid i
  • issm/trunk/src/m/classes/public/mesh/meshexprefine.m

    r1214 r1236  
    3838end
    3939
    40 %Read domainname file into a matlab array (x,y):
     40%Read domainame file into a matlab array (x,y):
    4141refinearea=ContourToMesh(md.elements,md.x,md.y,expread(domainname,1),'element',1);
    42 aires=area(md);
     42aires=Getareas(md.elements,md.x,md.y);
    4343
    4444%flags areas within the domain
  • issm/trunk/src/m/classes/public/removeholes.m

    r1 r1236  
    2424end
    2525
    26 
    2726%Ok, retrieve and write domain outline without holes, to disk.
    2827domainoutline_string=md.domainoutline;
     
    3332%Now create new model with mesh based on DomainOutlineTemp:
    3433%get average resolution
    35 resolution=mean(sqrt(2*area(md)));
     34resolution=mean(sqrt(2*area(md.elements,md.x,md.y)));
    3635md2=model;
    3736md2=mesh(md2,'DomainOutlineTemp.exp',resolution);
  • issm/trunk/src/m/classes/public/shear2d.m

    r1 r1236  
    77%      [sx,sy,sxy,s]=shear2d(md);
    88
    9 alpha=zeros(md.numberofelements,3); beta=zeros(md.numberofelements,3);
    10 gamma=zeros(md.numberofelements,3); area=zeros(md.numberofelements,1);
    11 
    12 for n=1:md.numberofelements
    13         X=inv([md.x(md.elements(n,:)) md.y(md.elements(n,:)) ones(3,1)]);
    14         alpha(n,:)=X(1,:);
    15         beta(n,:)=X(2,:);
    16 end
    17 clear X;
    18 
     9[alpha beta]=GetNodalFunctionsCoeff(md.elements,md.x,md.y);
    1910
    2011summation=[1;1;1];
  • issm/trunk/src/m/classes/public/slope.m

    r1 r1236  
    1818end
    1919
    20 %initialization
    21 alpha=zeros(numberofelements,3);
    22 beta=zeros(numberofelements,3);
    23 
    24 %build some usefull variables
    25 summation=1/3*ones(3,1);
    26 x1=x(index(:,1)); x2=x(index(:,2)); x3=x(index(:,3)); y1=y(index(:,1)); y2=y(index(:,2)); y3=y(index(:,3));
    27 
    2820%compute nodal functions coefficients N(x,y)=alpha x + beta y + gamma
    29 invdet=1./(x1.*(y2-y3)-x2.*(y1-y3)+x3.*(y1-y2));
    30 alpha=[invdet.*(y2-y3) invdet.*(y3-y1) invdet.*(y1-y2)];
    31 beta=[invdet.*(x3-x2) invdet.*(x1-x3) invdet.*(x2-x1)];
     21[alpha beta]=GetNodalFunctionsCoeff(index,x,y);
    3222
    3323summation=[1;1;1];
  • issm/trunk/src/m/classes/public/thicknessevolution.m

    r1115 r1236  
    1313end
    1414
    15 %load some variables (it is much faster if the variab;es are loaded from md once for all)
    16 numberofelements=md.numberofelements;
     15%load some variables
    1716H=md.thickness;
    1817vx=md.vx;
    1918vy=md.vy;
    20 index=md.elements;
    21 x=md.x; y=md.y;
    22 
    23 %initialization
    24 alpha=zeros(md.numberofelements,3);
    25 beta=zeros(md.numberofelements,3);
    26 gradx=zeros(md.numberofgrids,1);
    27 grady=zeros(md.numberofgrids,1);
    28 
    29 %build some usefull variables
    30 line=index(:);
    31 summation=1/3*ones(3,1);
    32 linesize=3*numberofelements;
    33 x1=x(index(:,1)); x2=x(index(:,2)); x3=x(index(:,3)); y1=y(index(:,1)); y2=y(index(:,2)); y3=y(index(:,3));
    3419
    3520%compute nodal functions coefficients N(x,y)=alpha x + beta y + gamma
    36 invdet=1./(x1.*(y2-y3)-x2.*(y1-y3)+x3.*(y1-y2));
    37 alpha=[invdet.*(y2-y3) invdet.*(y3-y1) invdet.*(y1-y2)];
    38 beta=[invdet.*(x3-x2) invdet.*(x1-x3) invdet.*(x2-x1)];
     21[alpha beta]=GetNodalFunctionsCoeff(md.elements,md.x,md.y);
    3922
    4023%compute dhdt=div(Hu)
     24summation=1/3*ones(3,1);
    4125dhdt=(vx(index)*summation).*sum( H(index).*alpha,2) + (vy(index)*summation).*sum(H(index).*beta,2) ...
    4226        + ( H(index)*summation).*sum(vx(index).*alpha,2) + ( H(index)*summation).*sum(vy(index).*beta,2);
Note: See TracChangeset for help on using the changeset viewer.