9 #include "sll_working_precision.h"
35 sll_real64,
dimension(:),
allocatable :: xpg, wpg
37 sll_real64,
dimension(:, :),
allocatable :: dlag
52 sll_real64,
dimension(:, :),
allocatable ::
node
54 integer,
dimension(:, :),
allocatable ::
connec
64 integer,
dimension(:),
allocatable ::
prof,
kld
69 sll_real64,
parameter ::
big = 1.e20_f64
72 sll_real64,
dimension(:),
allocatable ::
phi,
rho
75 integer,
dimension(:),
allocatable ::
indexbc
82 sll_real64,
intent(in) :: x, y
91 sll_real64,
intent(in) :: x, y
93 source = -4.0_f64 + x - x + y - y
133 write (*, *)
'sll_s_init tableaux points de Gauss...'
135 allocate (xpg(
order + 1))
136 allocate (wpg(
order + 1))
145 dlag(1, 1) = -1.0_f64
146 dlag(1, 2) = -1.0_f64
154 wpg(1) = 1.0_f64/6.0_f64
155 wpg(2) = 4.0_f64/6.0_f64
156 wpg(3) = 1.0_f64/6.0_f64
157 dlag(1, 1) = -0.300000000000000000000000000000e1_f64
158 dlag(1, 2) = -0.100000000000000000000000000000e1_f64
159 dlag(1, 3) = 0.100000000000000000000000000000e1_f64
160 dlag(2, 1) = 0.400000000000000000000000000000e1_f64
161 dlag(2, 3) = -0.400000000000000000000000000000e1_f64
162 dlag(3, 1) = -0.100000000000000000000000000000e1_f64
163 dlag(3, 2) = 0.100000000000000000000000000000e1_f64
164 dlag(3, 3) = 0.300000000000000000000000000000e1_f64
167 xpg(2) = (1.0_f64 - sqrt(1.0_f64/5.0_f64))/2.0_f64
168 xpg(3) = (1.0_f64 + sqrt(1.0_f64/5.0_f64))/2.0_f64
170 wpg(1) = 1.0_f64/12.0_f64
171 wpg(2) = 5.0_f64/12.0_f64
172 wpg(3) = 5.0_f64/12.0_f64
173 wpg(4) = 1.0_f64/12.0_f64
174 dlag(1, 1) = -0.599999999999999999999999999998e1_f64
175 dlag(1, 2) = -0.161803398874989484820458683436e1_f64
176 dlag(1, 3) = 0.618033988749894848204586834362e0_f64
177 dlag(1, 4) = -0.999999999999999999999999999994e0_f64
178 dlag(2, 1) = 0.809016994374947424102293417177e1_f64
179 dlag(2, 2) = -0.1d-28
180 dlag(2, 3) = -0.223606797749978969640917366872e1_f64
181 dlag(2, 4) = 0.309016994374947424102293417184e1_f64
182 dlag(3, 1) = -0.309016994374947424102293417182e1_f64
183 dlag(3, 2) = 0.223606797749978969640917366872e1_f64
185 dlag(3, 4) = -0.809016994374947424102293417177e1_f64
186 dlag(4, 1) = 0.999999999999999999999999999994e0_f64
187 dlag(4, 2) = -0.618033988749894848204586834362e0_f64
188 dlag(4, 3) = 0.161803398874989484820458683436e1_f64
189 dlag(4, 4) = 0.599999999999999999999999999998e1_f64
192 xpg(2) = (1.0_f64 - sqrt(3.0_f64/7.0_f64))/2.0_f64
194 xpg(4) = (1.0_f64 + sqrt(3.0_f64/7.0_f64))/2.0_f64
196 wpg(1) = 1.0_f64/20.0_f64
197 wpg(2) = 49.0_f64/180.0_f64
198 wpg(3) = 32.0_f64/90.0_f64
199 wpg(4) = 49.0_f64/180.0_f64
200 wpg(5) = 1.0_f64/20.0_f64
201 dlag(1, 1) = -0.100000000000000000000000000000e2_f64
202 dlag(1, 2) = -0.248198050606196571569743868439e1_f64
203 dlag(1, 3) = 0.750000000000000000000000000000e0_f64
204 dlag(1, 4) = -0.518019493938034284302561315633e0_f64
205 dlag(1, 5) = 0.100000000000000000000000000002e1_f64
206 dlag(2, 1) = 0.135130049774484800076860550594e2_f64
207 dlag(2, 2) = -0.2e-28_f64
208 dlag(2, 3) = -0.267316915539090667050969419638e1_f64
209 dlag(2, 4) = 0.152752523165194666886268239794e1_f64
210 dlag(2, 5) = -0.282032835588485332564727827395e1_f64
211 dlag(3, 1) = -0.533333333333333333333333333328e1_f64
212 dlag(3, 2) = 0.349148624377587810025755976661e1_f64
213 dlag(3, 3) = 0.2e-28_f64
214 dlag(3, 4) = -0.349148624377587810025755976659e1_f64
215 dlag(3, 5) = 0.533333333333333333333333333332e1_f64
216 dlag(4, 1) = 0.282032835588485332564727827398e1_f64
217 dlag(4, 2) = -0.152752523165194666886268239791e1_f64
218 dlag(4, 3) = 0.267316915539090667050969419635e1_f64
219 dlag(4, 4) = -0.4e-28_f64
220 dlag(4, 5) = -0.135130049774484800076860550595e2_f64
221 dlag(5, 1) = -0.100000000000000000000000000000e1_f64
222 dlag(5, 2) = 0.518019493938034284302561315635e0_f64
223 dlag(5, 3) = -0.750000000000000000000000000006e0_f64
224 dlag(5, 4) = 0.248198050606196571569743868439e1_f64
225 dlag(5, 5) = 0.100000000000000000000000000000e2_f64
227 write (*, *) é
'pas prvu...'
236 integer,
parameter :: nlocmax = 25
238 integer,
dimension(4) :: invpermut1 = (/1, 2, 4, 3/)
239 integer,
dimension(9) :: invpermut2 = (/1, 5, 2, 8, 9, 6, 4, 7, 3/)
240 integer,
dimension(16) :: invpermut3 = (/1, 5, 6, 2, 12, 13, 14, 7, 11, 16, 15, 8, 4, 10, 9, 3/)
241 integer :: invpermut(
nloc), permut(
nloc), i, ii
243 write (*, *) é
'Trac gmsh...'
245 if (
order .gt. 3)
then
246 write (*, *) é
'ordre non prvu'
252 invpermut(1:
nloc) = invpermut1
255 invpermut(1:
nloc) = invpermut2
258 invpermut(1:
nloc) = invpermut3
261 write (*, *) é
'ordre non prvu'
266 permut(invpermut(i)) = i
269 open (101, file=
'sll_m_lobalap.msh')
270 write (101,
'(A)')
'$MeshFormat'
271 write (101,
'(A)')
'2 0 8'
272 write (101,
'(A)')
'$EndMeshFormat'
273 write (101,
'(A)')
'$Nodes'
276 write (101, *) i,
node(1, i),
node(2, i), 0._f64
278 write (101,
'(A)')
'$EndNodes'
279 write (101,
'(A)')
'$Elements'
282 write (101, *) i, typelem, 0, (
connec(permut(ii), i), ii=1,
nloc)
284 write (101,
'(A)')
'$EndElements'
285 write (101,
'(A)')
'$NodeData'
297 write (101,
'(A)')
'$EndNodeData'
306 integer :: iix, ix, iiy, iy, inoloc, ino, iel
307 sll_real64 :: du, dv, u, v, x, y, eps
312 write (*, *)
'Construction du maillage...'
313 write (*, *)
'Elements:',
nel,
' Noeuds:',
neq
334 inoloc = 1 + iix + (
order + 1)*iiy
339 u = ix*du + du*xpg(iix + 1)
340 v = iy*dv + dv*xpg(iiy + 1)
347 write (*, *)
" ino = ", ino
349 write (*, *) é
'Reprage noeuds du bord'
356 if (abs(u*(1 - u)*v*(1 - v)) .lt. eps)
nbc =
nbc + 1
368 if (abs(u*(1 - u)*v*(1 - v)) .lt. eps)
then
387 integer,
intent(in) :: nx0, ny0, order0
388 integer :: ino, iel, i, ii, j, jj
405 write (*, *)
'Allocation solution et source...'
419 write (*, *)
'Calcul structure matrice creuse...'
472 subroutine gradpg(iloc, ipg, grad, poids)
474 integer,
intent(in) :: iloc, ipg
475 sll_real64,
intent(out) :: grad(2), poids
476 integer :: ilocx, ilocy, ipgx, ipgy
479 ipgx = mod(ipg - 1,
order + 1) + 1
480 ipgy = (ipg - 1)/(
order + 1) + 1
484 ilocx = mod(iloc - 1,
order + 1) + 1
485 ilocy = (iloc - 1)/(
order + 1) + 1
489 grad(1) = dlag(ilocx, ipgx)*
delta(ilocy, ipgy)
490 grad(2) = dlag(ilocy, ipgy)*
delta(ilocx, ipgx)
492 poids = wpg(ipgx)*wpg(ipgy)
500 sll_real64 :: jac(2, 2), cojac(2, 2), det
501 sll_real64 :: gradref(2), xg, yg
502 sll_real64 :: grad(2), dxy(2), poids
503 integer :: iel, ipg, ii, jj, ig, ib, iib, ielx, iely
504 sll_real64,
dimension(order + 1, order + 1, nx, ny) :: dg_ex, dg_ey
509 write (*, *) éé
'Calcul champ lectrique...'
517 ielx = mod(iel - 1,
nx) + 1
518 iely = (iel - 1)/
nx + 1
521 ii = mod(ipg - 1,
order + 1) + 1
522 jj = (ipg - 1)/(
order + 1) + 1
537 call gradpg(iib, ipg, dxy, poids)
540 jac(1, 1) = jac(1, 1) +
node(1, ib)*dxy(1)
541 jac(1, 2) = jac(1, 2) +
node(1, ib)*dxy(2)
542 jac(2, 1) = jac(2, 1) +
node(2, ib)*dxy(1)
543 jac(2, 2) = jac(2, 2) +
node(2, ib)*dxy(2)
547 det = jac(1, 1)*jac(2, 2) - jac(1, 2)*jac(2, 1)
548 cojac(1, 1) = jac(2, 2)/det
549 cojac(2, 2) = jac(1, 1)/det
550 cojac(1, 2) = -jac(2, 1)/det
551 cojac(2, 1) = -jac(1, 2)/det
557 call gradpg(iib, ipg, gradref, poids)
559 grad = matmul(cojac, gradref)
560 dg_ex(ii, jj, ielx, iely) = dg_ex(ii, jj, ielx, iely) +
phi(ib)*grad(1)
561 dg_ey(ii, jj, ielx, iely) = dg_ey(ii, jj, ielx, iely) +
phi(ib)*grad(2)
572 sll_real64 :: jac(2, 2), cojac(2, 2), det
573 sll_real64 :: gradref_i(2), gradref_j(2), xg, yg
574 sll_real64 :: grad_i(2), grad_j(2), dxy(2), v, poids, vf
575 integer :: iel, ipg, i, ii, j, jj, ig, ib, iib
580 write (*, *)
'Assemblage matrice...'
603 call gradpg(iib, ipg, dxy, poids)
606 jac(1, 1) = jac(1, 1) +
node(1, ib)*dxy(1)
607 jac(1, 2) = jac(1, 2) +
node(1, ib)*dxy(2)
608 jac(2, 1) = jac(2, 1) +
node(2, ib)*dxy(1)
609 jac(2, 2) = jac(2, 2) +
node(2, ib)*dxy(2)
613 det = jac(1, 1)*jac(2, 2) - jac(1, 2)*jac(2, 1)
614 cojac(1, 1) = jac(2, 2)/det
615 cojac(2, 2) = jac(1, 1)/det
616 cojac(1, 2) = -jac(2, 1)/det
617 cojac(2, 1) = -jac(1, 2)/det
626 call gradpg(ii, ipg, gradref_i, poids)
628 grad_i = matmul(cojac, gradref_i)
633 call gradpg(jj, ipg, gradref_j, poids)
636 grad_j = matmul(cojac, gradref_j)
638 v = (grad_i(1)*grad_j(1) + grad_i(2)*grad_j(2))*det*poids
645 write (*, *)
'Assemblage conditions aux limites matrice...'
660 sll_real64 :: jac(2, 2), det
661 sll_real64 :: dxy(2), poids, vf
662 sll_real64,
dimension(order + 1, order + 1, nx, ny) :: dg_rho
663 integer :: iel, ipg, i, ii, jj, ig, ib, iib, ielx, iely
668 write (*, *)
'Assemblage second membre...'
674 ielx = mod(iel - 1,
nx) + 1
675 iely = (iel - 1)/
nx + 1
682 ii = mod(ipg - 1,
order + 1) + 1
683 jj = (ipg - 1)/(
order + 1) + 1
685 vf = dg_rho(ii, jj, ielx, iely)
698 call gradpg(iib, ipg, dxy, poids)
701 jac(1, 1) = jac(1, 1) +
node(1, ib)*dxy(1)
702 jac(1, 2) = jac(1, 2) +
node(1, ib)*dxy(2)
703 jac(2, 1) = jac(2, 1) +
node(2, ib)*dxy(1)
704 jac(2, 2) = jac(2, 2) +
node(2, ib)*dxy(2)
708 det = jac(1, 1)*jac(2, 2) - jac(1, 2)*jac(2, 1)
715 rho(ig) =
rho(ig) + vf*det*poids
719 write (*, *)
'Assemblage conditions aux limites rhs...'
735 integer :: nsym = 1, mp = 6, ifac = 1, isol = 0, ier
736 sll_real64 :: energ, vu(1), vfg(1)
738 write (*, *)
'Factorisation LU...'
741 vfg,
kld, vu,
neq, mp, ifac, isol, &
742 nsym, energ, ier,
nsky)
749 integer :: nsym = 1, mp = 6, ifac = 0, isol = 1, ier
752 write (*, *) é
'Rsolution...'
756 nsym, energ, ier,
nsky)
764 integer,
intent(in) :: i, j
766 sll_real64,
intent(in) :: val
768 if (i - j .gt.
prof(i) .or. j - i .gt.
prof(j))
then
769 write (*, *)
'(', i,
',', j,
') out of matrix profile'
776 else if (j .gt. i)
then
777 ll =
kld(j + 1) - j + i
780 ll =
kld(i + 1) - i + j
790 write (*, *) éé
'Libration mmoire...'
subroutine, public sll_s_assemb()
subroutine, public sll_s_assemb_rhs(dg_rho)
real(kind=f64) function source(x, y)
subroutine, public sll_s_compute_electric_field(dg_ex, dg_ey)
integer, dimension(:), allocatable kld
real(kind=f64), dimension(:), allocatable phi
subroutine add(val, i, j)
subroutine, public sll_s_computelu()
real(kind=f64), dimension(:), allocatable vinf
real(kind=f64) function potexact(x, y)
real(kind=f64) function delta(i, j)
real(kind=f64), dimension(:), allocatable vdiag
integer, dimension(:), allocatable indexbc
real(kind=f64), parameter big
subroutine, public sll_s_release()
real(kind=f64), dimension(:, :), allocatable node
subroutine, public sll_s_compute_phi()
integer, dimension(:, :), allocatable connec
integer, dimension(:), allocatable prof
real(kind=f64), dimension(:), allocatable rho
subroutine, public sll_s_init(nx0, ny0, order0)
subroutine gradpg(iloc, ipg, grad, poids)
subroutine, public sll_s_plotgmsh()
real(kind=f64), dimension(:), allocatable vsup
subroutine, public sll_s_map(u, v, x, y)
subroutine sol(vkgs, vkgd, vkgi, vfg, kld, vu, neq, mp, ifac, isol, nsym, energ, ier, nsky)