Changeset 1236
- Timestamp:
- 07/06/09 11:12:27 (15 years ago)
- 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 22 22 %initialization 23 23 weights=zeros(md.numberofgrids,1); 24 areas=zeros(md.numberofelements,1);25 24 data=data(:); 26 25 … … 34 33 if strcmpi(md.type,'3d') 35 34 rep=6; 35 areas=Getareas(index,md.x,md.y,md.z); 36 36 else 37 37 rep=3; 38 areas=Getareas(index,md.x,md.y); 38 39 end 39 40 summation=1/rep*ones(rep,1); 40 41 linesize=rep*numberofelements; 41 42 %compute the volume of each element43 areas=area(md);44 42 45 43 %update weights that holds the volume of all the element holding the grid i -
issm/trunk/src/m/classes/public/mechanicalproperties.m
r631 r1236 28 28 index=md.elements; 29 29 summation=[1;1;1]; 30 alpha=zeros(numberofelements,3);31 beta=zeros(numberofelements,3);32 %gamma=zeros(numberofelements,3);33 30 directionsstress=zeros(numberofelements,4); 34 31 directionsstrain=zeros(numberofelements,4); … … 37 34 38 35 %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); 46 37 47 38 %compute shear -
issm/trunk/src/m/classes/public/mesh/meshadaptation.m
r1214 r1236 22 22 disp(sprintf(' metric computation') ) 23 23 24 %load some variables (it is much faster if the variab;es are loaded from md once for all) 24 %initialization 25 index=md.elements; 26 numberofgrids=md.numberofgrids; 25 27 numberofelements=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); 28 gradx=zeros(numberofgrids,1); 29 grady=zeros(numberofgrids,1); 30 metric=zeros(numberofelements,1); 36 31 37 32 %build some usefull variables … … 40 35 summation=1/3*ones(3,1); 41 36 linesize=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));43 37 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); 40 areas=Getareas(index,md.x,md.y); 48 41 49 42 %Compute gradient for each element 50 43 grad_elx=sum(field(index).*alpha,2); 51 44 grad_ely=sum(field(index).*beta,2); 52 53 %compute the volume of each element54 areas=area(md);55 45 56 46 %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 38 38 end 39 39 40 %Read domain name file into a matlab array (x,y):40 %Read domainame file into a matlab array (x,y): 41 41 refinearea=ContourToMesh(md.elements,md.x,md.y,expread(domainname,1),'element',1); 42 aires= area(md);42 aires=Getareas(md.elements,md.x,md.y); 43 43 44 44 %flags areas within the domain -
issm/trunk/src/m/classes/public/removeholes.m
r1 r1236 24 24 end 25 25 26 27 26 %Ok, retrieve and write domain outline without holes, to disk. 28 27 domainoutline_string=md.domainoutline; … … 33 32 %Now create new model with mesh based on DomainOutlineTemp: 34 33 %get average resolution 35 resolution=mean(sqrt(2*area(md )));34 resolution=mean(sqrt(2*area(md.elements,md.x,md.y))); 36 35 md2=model; 37 36 md2=mesh(md2,'DomainOutlineTemp.exp',resolution); -
issm/trunk/src/m/classes/public/shear2d.m
r1 r1236 7 7 % [sx,sy,sxy,s]=shear2d(md); 8 8 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); 19 10 20 11 summation=[1;1;1]; -
issm/trunk/src/m/classes/public/slope.m
r1 r1236 18 18 end 19 19 20 %initialization21 alpha=zeros(numberofelements,3);22 beta=zeros(numberofelements,3);23 24 %build some usefull variables25 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 28 20 %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); 32 22 33 23 summation=[1;1;1]; -
issm/trunk/src/m/classes/public/thicknessevolution.m
r1115 r1236 13 13 end 14 14 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 17 16 H=md.thickness; 18 17 vx=md.vx; 19 18 vy=md.vy; 20 index=md.elements;21 x=md.x; y=md.y;22 23 %initialization24 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 variables30 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));34 19 35 20 %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); 39 22 40 23 %compute dhdt=div(Hu) 24 summation=1/3*ones(3,1); 41 25 dhdt=(vx(index)*summation).*sum( H(index).*alpha,2) + (vy(index)*summation).*sum(H(index).*beta,2) ... 42 26 + ( 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.