Mathematical Physics - Volume II - Numerical Methods

Chapter 3. Comparison of finite element method and finite difference method

94

SUBROUTINE relem PARAMETER (maxn=400,maxe=100,maxm=5,maxbce=70,maxbcn=40,maxpt=10, & maxband=25) COMMON /ccon / nnode , nelem , nmat , nbce , nbcn , npoint , & nband COMMON /celem / ne(maxe) , mat(maxe) , nodes(9,maxe) DIMENSION node(9) c read element data READ (5,*) READ (5,*) nrec IF ( nrec.LT.1 ) STOP ’number of element records less than 1’ nel = 0 nband = 0 DO 200 irec = 1 , nrec READ (5,*) num , inc , nee , mate , (node(i),i=1,nee) nmin = maxn + 1 nmax = 0 DO 50 i = 1 , nee CONTINUE nband = max(nband,nmax-nmin) + 1 IF ( nband.GT.maxband ) STOP ’band width too big’ n1 = nel + 1 nel = nel + num IF ( nel.GT.maxe ) STOP ’number of elements greater than nelem’ DO 100 n = n1 , nel nmin = min(nmin,node(i)) nmax = max(nmax,node(i)) 50

ninc = (n-n1)*inc DO 60 m = 1 , nee

nodes(m,n) = node(m) + ninc

60

CONTINUE ne(n) = nee mat(n) = mate

100 CONTINUE 200 CONTINUE nelem = nel c print element definitions and find band width WRITE (6,99001) DO 300 n = 1 , nelem nen = ne(n) 300 CONTINUE RETURN 99001 FORMAT (/’ elem no ne mat’,10X,’node numbers’/) 99002 FORMAT (I5,I7,I6,5X,9I4) END

WRITE (6,99002) n , nen , mat(n) , (nodes(i,n),i=1,nen)

SUBROUTINE rmat PARAMETER (maxn=400,maxe=100,maxm=5,maxbce=70,maxbcn=40,maxpt=10,

Made with FlippingBook flipbook maker