Code covered by the BSD License  

Highlights from
Double porosity model

image thumbnail

Double porosity model

by

 

Finite element solution of the double porosity model and its a posteriori error estimate

[element2edges, edge2nodes]=getEdges(elements)
function [element2edges, edge2nodes]=getEdges(elements)
%function: [element2edges, edge2nodes]=edge_numbering(elements)
%requires: deleterepeatedrows
%generates edges of (triangular) triangulation defined in elements
%elements is matrix, whose rows contain numbers of its element nodes 
%element2edges returns edges numbers of each triangular element
%edge2nodes returns two node numbers of each edge
%example: [element2edges, edge2nodes]=edge_numbering([1 2 3; 2 4 3])

%extracts sets of edges 
edges1=elements(:,[2 3]);
edges2=elements(:,[3 1]);
edges3=elements(:,[1 2]);

%as sets of their nodes (vertices)
vertices=zeros(size(elements,1)*3,2);
vertices(1:3:end,:)=edges1;
vertices(2:3:end,:)=edges2;
vertices(3:3:end,:)=edges3;

%repeated sets of nodes (joint edges) are eliminated 
[edge2nodes,element2edges]=deleterepeatedrows(vertices);
element2edges=reshape(element2edges,size(elements,2),size(elements,1))';


Contact us