1 |
%*********************************************************************** |
---|
2 |
%*********************************************************************** |
---|
3 |
% SUBROUTINE FEMGEN(nndim,nedim,nseg,nnv,x,y,nele,in) |
---|
4 |
%----------------------------------------------------------------------- |
---|
5 |
% purpose: This subroutine creates a 2-D Finite Element incidence list |
---|
6 |
% for a 2-D grid of points (nseg+1)*nnv. |
---|
7 |
% |
---|
8 |
% restrictions: the coordinates of the nodes for which the |
---|
9 |
% incidence list is being created must increase from |
---|
10 |
% bottom to top and left to right, ie (for nseg=2,nnv=3): |
---|
11 |
% |
---|
12 |
% 3 6 9 |
---|
13 |
% 2 5 8 |
---|
14 |
% 1 4 7 |
---|
15 |
% |
---|
16 |
% index range: kk=1,nele |
---|
17 |
% |
---|
18 |
% inputs: Dimensioning parameters |
---|
19 |
% nndim - parametered size of arrays indexed with i,m,n |
---|
20 |
% nedim - parametered size of arrays indexed with kk |
---|
21 |
% Vertical slice 2-D mesh data |
---|
22 |
% nseg - number of horizontal sections |
---|
23 |
% nnv - number of nodes in the vertical (constant) |
---|
24 |
% |
---|
25 |
% outputs: nele - number of elements = (nseg*(nnv-1)) |
---|
26 |
% in - incidence list |
---|
27 |
% |
---|
28 |
% history: Written by Christopher E. Naimie |
---|
29 |
% Dartmouth College |
---|
30 |
% 1993, MAY 4 - fortran version |
---|
31 |
% 1997, OCT 9 - matlab version |
---|
32 |
%----------------------------------------------------------------------- |
---|
33 |
% integer in(3,nedim) |
---|
34 |
% real x(nndim),y(nndim) |
---|
35 |
% |
---|
36 |
% START OF EXECUTABLE CODE |
---|
37 |
clear in |
---|
38 |
kk=0; |
---|
39 |
for i=1:nseg |
---|
40 |
for j=1:nnv-1 |
---|
41 |
n1=(i-1)*nnv+j; |
---|
42 |
n2=n1+nnv; |
---|
43 |
n3=n2+1; |
---|
44 |
n4=n1+1; |
---|
45 |
s21=(x(n3)-x(n1))^2.0+(y(n3)-y(n1))^2.0; |
---|
46 |
s22=(x(n2)-x(n4))^2.0+(y(n4)-y(n2))^2.0; |
---|
47 |
if s21<s22 |
---|
48 |
kk=kk+1; |
---|
49 |
in(1,kk)=n1; |
---|
50 |
in(2,kk)=n2; |
---|
51 |
in(3,kk)=n3; |
---|
52 |
kk=kk+1; |
---|
53 |
in(1,kk)=n1; |
---|
54 |
in(2,kk)=n3; |
---|
55 |
in(3,kk)=n4; |
---|
56 |
else |
---|
57 |
kk=kk+1; |
---|
58 |
in(1,kk)=n1; |
---|
59 |
in(2,kk)=n2; |
---|
60 |
in(3,kk)=n4; |
---|
61 |
kk=kk+1; |
---|
62 |
in(1,kk)=n2; |
---|
63 |
in(2,kk)=n3; |
---|
64 |
in(3,kk)=n4; |
---|
65 |
end |
---|
66 |
end |
---|
67 |
end |
---|
68 |
ne=kk; |
---|
69 |
in=in'; |
---|
70 |
% if(nele.GT.nedim)then |
---|
71 |
% write(*,*)' Increase nedim, the number of elements >',nedim |
---|
72 |
% stop |
---|
73 |
% endif |
---|
74 |
% |
---|
75 |
% END OF EXECUTABLE CODE |
---|
76 |
% return |
---|
77 |
% end |
---|
78 |
%*********************************************************************** |
---|
79 |
%*********************************************************************** |
---|