20 INTEGER,
POINTER :: me, mes
21 INTEGER,
DIMENSION(:, :),
POINTER :: jj
22 INTEGER,
DIMENSION(:, :),
POINTER :: js
23 REAL(KIND=8),
DIMENSION(:, :),
POINTER :: rr
25 INTEGER,
PARAMETER :: k_d = 2, n_w = 3, l_g = 3, &
28 REAL(KIND=8),
DIMENSION(:, :),
POINTER :: ww
29 REAL(KIND=8),
DIMENSION(:, :),
POINTER :: wws
30 REAL(KIND=8),
DIMENSION(:, :, :, :),
POINTER :: dw
31 REAL(KIND=8),
DIMENSION(:, :, :),
POINTER :: rnorms
32 REAL(KIND=8),
DIMENSION(:, :),
POINTER :: rj
33 REAL(KIND=8),
DIMENSION(:, :),
POINTER :: rjs
34 REAL(KIND=8),
DIMENSION(:, :, :, :),
POINTER :: dw_s
35 REAL(KIND=8),
DIMENSION(:, :, :, :),
POINTER :: dwps
36 REAL(KIND=8),
DIMENSION(:, :, :, :),
POINTER :: dws
38 REAL(KIND=8),
DIMENSION(k_d, n_w, l_G) :: dd
39 REAL(KIND=8),
DIMENSION(1, n_ws, l_Gs) :: dds
40 REAL(KIND=8),
DIMENSION(l_G) :: pp
41 REAL(KIND=8),
DIMENSION(l_Gs) :: pps
42 REAL(KIND=8),
DIMENSION(n_w) :: r
43 REAL(KIND=8),
DIMENSION(n_ws) :: rs
44 REAL(KIND=8),
DIMENSION(k_d, k_d) :: dr
45 REAL(KIND=8),
DIMENSION(1, k_d) :: drs
47 REAL(KIND=8) :: rjac, rjacs, x
48 INTEGER :: m, l, k, k1, n, ms, ls, face, n1, n2, cote
49 REAL(KIND=8),
DIMENSION(2) :: rnor, rsd
51 REAL(KIND=8),
DIMENSION(n_w, l_G) :: ww_s
54 INTEGER,
DIMENSION(n_ws) :: nface
55 INTEGER,
DIMENSION(l_Gs) :: ngauss
64 IF (mesh%edge_stab)
THEN
65 ALLOCATE(mesh%gauss%dwni(n_w, l_gs, 2, mesh%mi))
66 ALLOCATE(mesh%gauss%rji(l_gs, mesh%mi))
67 ALLOCATE(mesh%gauss%rnormsi(k_d, l_gs, 2, mesh%mi))
68 ALLOCATE(mesh%gauss%wwsi(n_ws, l_gs))
72 ALLOCATE(mesh%gauss%ww(n_w, l_g))
73 ALLOCATE(mesh%gauss%wws(n_ws, l_gs))
74 ALLOCATE(mesh%gauss%dw(k_d, n_w, l_g, me ))
75 ALLOCATE(mesh%gauss%rnorms(k_d, l_gs, mes))
76 ALLOCATE(mesh%gauss%rj(l_g, me ))
77 ALLOCATE(mesh%gauss%rjs(l_gs, mes))
79 ALLOCATE(mesh%gauss%dw_s(k_d, n_w, l_gs, mesh%mes))
81 ALLOCATE(mesh%gauss%dwps(1, n_ws, l_gs, mes))
82 ALLOCATE(mesh%gauss%dws(1, n_ws, l_gs, mes))
87 rnorms => mesh%gauss%rnorms
91 dw_s => mesh%gauss%dw_s
93 dwps => mesh%gauss%dwps
99 mesh%gauss%n_ws = n_ws
100 mesh%gauss%l_Gs = l_gs
116 dr(k, k1) = sum(r * dd(k1,:,l))
120 rjac = dr(1,1)*dr(2,2) - dr(1,2)*dr(2,1)
124 = (+ dd(1,n,l)*dr(2,2) - dd(2,n,l)*dr(2,1))/rjac
126 = (- dd(1,n,l)*dr(1,2) + dd(2,n,l)*dr(1,1))/rjac
129 rj(l, m) = rjac * pp(l)
142 IF (minval(abs(js(:,ms)-jj(n,m)))==0) cycle
146 n1 = modulo(face,3)+1; n2 = modulo(face+1,3)+1
147 IF (js(1,ms)==jj(n1,m) .AND. js(2,ms)==jj(n2,m))
THEN
148 nface(1)=n1; nface(2)=n2
149 ngauss(1)=1; ngauss(2)=2
150 ELSE IF (js(1,ms)==jj(n2,m) .AND. js(2,ms)==jj(n1,m))
THEN
151 nface(1)=n2; nface(2)=n1
152 ngauss(1)=2; ngauss(2)=1
154 WRITE(*,*)
' BUG : gauss_points_2d_p1'
164 dr(k, k1) = sum(r * dd(k1,:,ls))
168 rjac = (dr(1,1)*dr(2,2) - dr(1,2)*dr(2,1))
171 dw_s(1, n, ngauss(ls), ms) &
172 = (+ dd(1,n,ls)*dr(2,2) - dd(2,n,ls)*dr(2,1))/rjac
173 dw_s(2, n, ngauss(ls), ms) &
174 = (- dd(1,n,ls)*dr(1,2) + dd(2,n,ls)*dr(1,1))/rjac
196 drs(1, k) = sum(rs * dds(1,:,ls))
199 rjacs = sqrt( drs(1,1)**2 + drs(1,2)**2 )
201 rnorms(1, ls, ms) = - drs(1,2)/rjacs
202 rnorms(2, ls, ms) = + drs(1,1)/rjacs
204 rjs(ls, ms) = rjacs * pps(ls)
209 IF (minval(abs(js(:,ms)-jj(n,m)))==0) cycle
212 rs = rr(:,jj(face,m)) - (rr(:,js(1,ms))+rr(:,js(2,ms)))/2
213 x = sum(rnorms(:,ls,ms)*rs)
215 rnorms(:,ls,ms) = -rnorms(:,ls,ms)
240 dwps(1, :, ls, ms) = dds(1, :, ls) * pps(ls)
241 dws(1, :, ls, ms) = dds(1, :, ls)
249 IF (mesh%edge_stab)
THEN
253 m = mesh%neighi(cote,ms)
256 IF (minval(abs(mesh%jjsi(:,ms)-jj(n,m)))==0) cycle
260 n1 = modulo(face,3)+1; n2 = modulo(face+1,3)+1
261 IF (mesh%jjsi(1,ms)==jj(n1,m) .AND. mesh%jjsi(2,ms)==jj(n2,m))
THEN
262 nface(1)=n1; nface(2)=n2
263 ngauss(1)=1; ngauss(2)=2
264 ELSE IF (mesh%jjsi(1,ms)==jj(n2,m) .AND. mesh%jjsi(2,ms)==jj(n1,m))
THEN
265 nface(1)=n2; nface(2)=n1
266 ngauss(1)=2; ngauss(2)=1
268 WRITE(*,*)
' BUG : gauss_points_2d_p1'
274 rs = rr(k, mesh%jjsi(:,ms))
275 drs(1, k) = sum(rs * dds(1,:,ls))
277 rjacs = sqrt( drs(1,1)**2 + drs(1,2)**2 )
278 mesh%gauss%rji(ls, ms) = rjacs * pps(ls)
279 rnor(1) = drs(1,2)/rjacs
280 rnor(2) = - drs(1,1)/rjacs
281 mesh%gauss%rnormsi(1, ls, cote, ms) = rnor(1)
282 mesh%gauss%rnormsi(2, ls, cote, ms) = rnor(2)
283 rsd = rr(:,jj(face,m)) - (rr(:,mesh%jjsi(1,ms))+rr(:,mesh%jjsi(2,ms)))/2
294 dr(k, k1) = sum(r * dd(k1,:,ls))
297 rjac = (dr(1,1)*dr(2,2) - dr(1,2)*dr(2,1))
303 mesh%gauss%dwni(n, ngauss(ls), cote, ms) &
304 = rnor(1)*(+ dd(1,n,ls)*dr(2,2) - dd(2,n,ls)*dr(2,1))/rjac &
305 + rnor(2)*(- dd(1,n,ls)*dr(1,2) + dd(2,n,ls)*dr(1,1))/rjac
313 m = mesh%neighi(cote,ms)
315 x = abs(sqrt(sum(mesh%gauss%rnormsi(:, ls, cote, ms)**2))-1.d0)
317 IF (x.GE.1.d-13)
THEN
318 write(*,*)
'Bug1 in normal '
321 rjac = (rr(1, mesh%jjsi(2,ms)) - rr(1, mesh%jjsi(1,ms)))*mesh%gauss%rnormsi(1, ls, cote, ms) &
322 + (rr(2, mesh%jjsi(2,ms)) - rr(2, mesh%jjsi(1,ms)))*mesh%gauss%rnormsi(2, ls, cote, ms)
323 x = sqrt((rr(1, mesh%jjsi(2,ms)) - rr(1, mesh%jjsi(1,ms)))**2 +&
324 (rr(2, mesh%jjsi(2,ms)) - rr(2, mesh%jjsi(1,ms)))**2)
326 IF (abs(rjac/x ).GE. 1.d-13)
THEN
327 write(*,*)
'Bug2 in normal '
359 REAL(KIND=8),
DIMENSION( n_w, l_G),
INTENT(OUT) :: w
360 REAL(KIND=8),
DIMENSION(2, n_w, l_G),
INTENT(OUT) :: d
361 REAL(KIND=8),
DIMENSION(l_G),
INTENT(OUT) :: p
363 REAL(KIND=8),
DIMENSION(l_G) :: xx, yy
366 REAL(KIND=8) :: zero = 0, one = 1, two = 2, three = 3, six = 6
368 REAL(KIND=8) :: f1, f2, f3, x, y
369 f1(x, y) = one - x - y
373 xx(1) = one/six; xx(2) = two/three; xx(3) = one/six
374 yy(1) = one/six; yy(2) = one/six; yy(3) = two/three
378 w(1, j) = f1(xx(j), yy(j))
382 w(2, j) = f2(xx(j), yy(j))
386 w(3, j) = f3(xx(j), yy(j))
410 INTEGER,
INTENT(IN) :: face
411 REAL(KIND=8),
DIMENSION(2, n_w, l_Gs),
INTENT(OUT) :: d
412 REAL(KIND=8),
DIMENSION( n_w, l_G),
INTENT(OUT) :: w
414 REAL(KIND=8),
DIMENSION(l_Gs) :: xx, yy
417 REAL(KIND=8) :: zero = 0, one = 1, three=3, half = 0.5d0
419 REAL(KIND=8) :: f1, f2, f3, x, y
425 xx(1) = half + half/sqrt(three)
426 yy(1) = half - half/sqrt(three)
428 xx(2) = half - half/sqrt(three)
429 yy(2) = half + half/sqrt(three)
430 ELSE IF (face==2)
THEN
432 yy(1) = half + half/sqrt(three)
435 yy(2) = half - half/sqrt(three)
437 xx(1) = half - half/sqrt(three)
440 xx(2) = half + half/sqrt(three)
445 w(1,j) = f1(xx(j), yy(j))
449 w(2,j) = f2(xx(j), yy(j))
453 w(3,j) = f3(xx(j), yy(j))
473 REAL(KIND=8),
DIMENSION( n_ws, l_Gs),
INTENT(OUT) :: w
474 REAL(KIND=8),
DIMENSION(1, n_ws, l_Gs),
INTENT(OUT) :: d
475 REAL(KIND=8),
DIMENSION(l_Gs),
INTENT(OUT) :: p
477 REAL(KIND=8),
DIMENSION(l_Gs) :: xx
480 REAL(KIND=8) :: one = 1, two = 2, three = 3
482 REAL(KIND=8) :: f1, f2, x
483 f1(x) = (one - x)/two
484 f2(x) = (x + one)/two
486 xx(1) = - one/sqrt(three)
487 xx(2) = + one/sqrt(three)
492 d(1, 1, j) = - one/two
495 d(1, 2, j) = + one/two
subroutine element_1d(w, d, p)
subroutine element_2d_boundary(face, d, w)
Defines gauss quadrature for faces of triangular element with linear interpolation and two Gauss inte...
subroutine element_2d(w, d, p)
Defines gauss quadrature for triangular element with linear interpolation and three Gauss integration...
subroutine, public gauss_points_2d_p1(mesh)
Prepares gauss points for P1 approximation in 2D.