Non Uniform Meshing in 1D Fem

12 views (last 30 days)
Chris Dan
Chris Dan on 3 Dec 2019
Edited: Chris Dan on 3 Dec 2019
Hello, I am developing a 1D fem problem, I know how to create a uniform mesh, but does any one know how to create a non uniform mesh AFTER the uniform mesh is created.
For eg, if we have 5 elements, we have 6 nodes created, but now the user wants to create another node between 4 and 5 node. This would result in 6 elements and 7 nodes.
Does anyone know how to do that? or any links, here is my code, so far
%number of elements the solution 1D FEM
nE=3;
xb = 1
xa = 0
%generate nodes
nN=nE+1;
if nE<1
error('Number of elements <1');
end
%initiliasation ( speeds up calculations)
Nod= zeros(nN,1);
Elm = zeros(nE,2);
%generate list of nodes
for i=1:1:nN
Nod(i,1) = xa + (i-1)*(xb-xa)/nE;
end
%generate connectivity array for elelments
for k=1:1:nE
Elm(k,1)=k;
Elm(k,2)=k+1;
end

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!