Mathematical Physics - Volume II - Numerical Methods

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

102

c

call assmb to add pe to gk and game to gf CALL assmb(pe,game,3,nod)

150 CONTINUE ENDIF RETURN END

SUBROUTINE bcint(v1,v2,x,pe,game) COMMON /cint1 / etaq(3) , ww(3) DIMENSION theta(3) , dtheta(3) DIMENSION x(2,3) , pe(3,3) , game(3) DO 100 i = 1 , 3 game(i) = 0. DO 50 j = 1 , 3 pe(i,j) = 0.

50

CONTINUE

100 CONTINUE

DO 200 k = 1 , 3 CALL shape1(etaq(k),theta,dtheta)

x1 = x(1,1)*dtheta(1) + x(1,2)*dtheta(2) + x(1,3)*dtheta(3) y1 = x(2,1)*dtheta(1) + x(2,2)*dtheta(2) + x(2,3)*dtheta(3) sjac = sqrt(x1*x1+y1*y1)

fac = ww(k)*sjac DO 150 i = 1 , 3 game(i) = game(i) + v2*theta(i)*fac DO 120 j = 1 , 3

pe(i,j) = pe(i,j) + v1*theta(i)*theta(j)*fac

120

CONTINUE

150 CONTINUE 200 CONTINUE RETURN END

SUBROUTINE shape1(eta,theta,dtheta) DIMENSION theta(3) , dtheta(3) eta2 = eta*eta theta(1) = (eta2-eta)/2. theta(2) = 1. - eta2 theta(3) = (eta2+eta)/2. dtheta(1) = eta - 0.5 dtheta(2) = -2.*eta dtheta(3) = eta + 0.5 RETURN END

SUBROUTINE solve PARAMETER (maxn=400,maxe=100,maxm=5,maxbce=70,maxbcn=40,maxpt=10, & maxband=25) COMMON /ccon / nnode , nelem , nmat , nbce , nbcn , npoint ,

Made with FlippingBook flipbook maker