Download SEPRAN

Transcript
4.5.2
Two unknowns
August 2014
subroutine elemsubr ( npelm, x, y, nunk_pel, elem_mat, &
elem_vec, elem_mass, prevsolution, itype )
!
!
!
INPUT / OUTPUT PARAMETERS
implicit none
integer, intent(in) :: npelm, nunk_pel, itype
double precision, intent(in) :: x(1:npelm), y(1:npelm), &
prevsolution(1:nunk_pel)
double precision, intent(out) :: elem_mat(1:nunk_pel,1:nunk_pel), &
elem_vec(1:nunk_pel), &
elem_mass(1:nunk_pel)
! **********************************************************************
!
!
LOCAL PARAMETERS
!
double precision :: beta(1:3), gamma(1:3), delta, suu(3,3), &
suv(3,3), svu(3,3), svv(3,3)
integer :: i, j
! ======================================================================
!
!
--- Compute the factors beta, gamma and delta as defined in NMSC
delta = (x(2)-x(1))*(y(3)-y(1))-(y(2)-y(1))*(x(3)-x(1))
beta(1) = (y(2)-y(3))/delta
beta(2) = (y(3)-y(1))/delta
beta(3) = (y(1)-y(2))/delta
gamma(1) = (x(3)-x(2))/delta
gamma(2) = (x(1)-x(3))/delta
gamma(3) = (x(2)-x(1))/delta
!
!
--- Fill the element matrix as defined in the Lecture Notes
We start with the four submatrices
do j = 1, 3
do i = 1, 3
suu(i,j) = 0.5d0 * abs(delta) *
&
( beta(i)*beta(j) + gamma(i)*gamma(j) )
end do
end do
svv = suu
suv = 0d0
svu = 0d0
!
--- Fill the diagonal of the matrices suv and svu
do i = 1, 3
suv(i,i) = abs(delta)/6d0
svu(i,i) = abs(delta)/6d0
end do
!
!
--- Put the four submatrices in the element matrix in the
correct sequence, i.e. u1, v1, u2, v2, u3, v3
do j = 1, 3
PRAC