11 real(r8),
allocatable,
private :: qq(:)
12 real(r8),
allocatable,
private :: gpx(:, :, :), gpjac(:, :, :)
13 integer(itm_i4),
allocatable,
private :: indices(:), inv_index(:)
24 integer(itm_i4) :: nr, np
26 allocate(qq(4 * nr * np))
27 allocate(gpx(4, 4, (nr - 1) * (np - 1)))
28 allocate(gpjac(4, 4, (nr - 1) * (np - 1)))
29 allocate(indices(nr * np))
30 allocate(inv_index(nr * np))
47 deallocate(gpx, gpjac)
48 deallocate(indices, inv_index)
52 subroutine find_axis(psaxis, xaxis, yaxis, nax, rax, sax)
63 real(r8),
intent(out) :: psaxis
64 real(r8),
intent(inout) :: xaxis
65 real(r8),
intent(inout) :: yaxis
66 real(r8),
intent(inout) :: rax, sax
67 integer(itm_i4),
intent(out) :: nax
69 real(r8),
dimension(2) :: x
71 real(r8) :: x_err, f_err
72 real(r8),
parameter :: tol_x=1.e-8_r8, tol_f=1.e-8_r8
73 real(r8),
parameter :: tol_rs=1.0001_r8
74 real(r8) :: r, s, zpsi
75 real(r8) :: psi_00, psi_00_min
76 integer(itm_i4) :: i, n_start
77 integer(itm_i4) :: naxis
78 integer(itm_i4) :: n1, n2, n3, n4
79 integer(itm_i4) :: nelm
80 integer(itm_i4) :: neq2, ntrial, ifail
81 integer(itm_i4) :: naxis_00
82 logical :: minimum_found
84 minimum_found = .false.
92 nelm = (nr - 1) * (np - 1)
95 do i = nelm, nelm / 2, -1
101 call
interpolation(0, psi(4 * (n1 - 1) + 1), psi(4 * (n2 - 1) + 1), &
102 psi(4 * (n3 - 1) + 1), psi(4 * (n4 - 1) + 1), x(1), x(2), psi_00)
103 if (psi_00 .lt. psi_00_min)
then
107 call
mnewtax(ntrial, naxis, x, neq2, tol_x, tol_f, x_err, f_err)
108 if (x_err <= tol_x .or. f_err <= tol_f)
then
116 if (ifail == 0 .and. abs(r) <= tol_rs .and. abs(s) <= tol_rs)
then
117 minimum_found = .true.
119 call
interpolation(0, psi(4 * (n1 - 1) + 1), psi(4 * (n2 - 1) &
120 + 1), psi(4 * (n3 - 1) + 1), psi(4 * (n4 - 1) + 1), r, s, zpsi)
121 if (zpsi < psmin)
then
129 if (naxis_00 .gt. 0)
then
132 if (.not. minimum_found)
then
133 write(iu6, *)
'fatal error: no axis found'
137 call
interpolation(0, xx(1, n1), xx(1, n2), xx(1, n3), xx(1, n4), &
139 call
interpolation(0, yy(1, n1), yy(1, n2), yy(1, n3), yy(1, n4), &
145 call
axis_symm(psaxis, xaxis, yaxis, nax, rax, sax, n_start)
147 call
axis_symm(psaxis, xaxis, yaxis, nax, rax, sax, n_start)
154 subroutine axis_symm(psaxis, xaxis, yaxis, nax, rax, sax, n_start)
160 real(r8),
intent(inout) :: psaxis
161 real(r8),
intent(inout) :: xaxis
162 real(r8),
intent(inout) :: yaxis
163 real(r8),
intent(inout) :: rax, sax
164 integer(itm_i4),
intent(inout) :: nax
165 integer(itm_i4),
intent(in) :: n_start
167 real(r8) :: r, dummy, psmin
168 real(r8),
parameter :: tol = 1._r8 + 1.e-8_r8
169 integer(itm_i4) :: n, n1, n2, ifail
173 do n = n_start, (nr - 1) * (np - 1), np - 1
174 if (n_start == 1)
then
181 if (psi(4 * (n1 - 1) + 2) * psi(4 * (n2 - 1) + 2) <= 0.)
then
183 call
quad_equation(psi(4 * (n1 - 1) + 1), psi(4 * (n1 - 1) + 2), &
184 psi(4 * (n2 - 1) + 1), psi(4 * (n2 - 1) + 2), tol, r, ifail)
187 xx(2, n2), r, xaxis, dummy)
189 psi(4 * (n2 - 1) + 1), psi(4 * (n2 - 1) + 2),r, psaxis, dummy)
190 if (psaxis < psmin)
then
194 if (n_start == 1)
then
199 if (standard_output) &
200 write(out_he, *)
'local minimum at xaxis = ', xaxis
234 real(r8),
intent(in) :: a
235 logical,
intent(in) :: first
237 real(r8) :: r, wr, s, ws, wrs
238 real(r8) :: x, xr, xs, yr, ys, ps
241 real(r8) :: sumq, sumk
243 real(r8) :: psix, psiy
244 integer(itm_i4) :: i, j, k, l, n, ngr, ngs
245 integer(itm_i4) :: nelm
246 integer(itm_i4) :: n1, n2, n3, n4
247 integer(itm_i4) :: nrow, ncol, noff, nend
248 logical,
parameter :: invert_index = .false.
250 nelm = (np - 1) * (nr - 1)
258 do i = 1, 4 * nr * np
275 xx(1, n4), r, s, x, xr, xs, yn1 = yy(1, n1), yn2 = yy(1, n2), &
276 yn3 = yy(1, n3), yn4 = yy(1, n4), pn1 = psi(4 * (n1- 1) + 1), &
277 pn2 = psi(4 * (n2 - 1) + 1), pn3 = psi(4 * (n3 - 1) + 1), &
278 pn4 = psi(4 * (n4 - 1) + 1), yr = yr, ys = ys, ps = ps)
280 xjac = xr * ys - xs * yr
282 gpjac(ngr, ngs, n) = xjac
284 arhs =
rh_side(a, x, 0._r8, 0._r8, 0._r8, 0._r8, ps, 0._r8, 0._r8)
289 nrow = 4 * (indices(nodeno(n, i)) - 1) + j
290 sumq = -arhs * h(j, i, ngr, ngs) * xjac
291 vx = ys * hr(j, i, ngr, ngs) - yr * hs(j, i, ngr, ngs)
292 vy = -xs * hr(j, i, ngr, ngs) + xr * hs(j, i, ngr, ngs)
293 qq(nrow) = qq(nrow) - wrs * sumq
298 ncol = 4 * (indices(nodeno(n, k)) - 1) + l
301 psix = ys * hr(l, k, ngr, ngs) - yr * hs(l, k, ngr, ngs)
302 psiy = -xs * hr(l, k, ngr, ngs) + xr * hs(l, k, ngr, ngs)
303 sumk = -1. / (1. + eps * x) * (psix * vx + psiy * vy) &
305 kkbig(noff + 1, ncol) = kkbig(noff + 1, ncol) + wrs &
317 if (ias == 0) nend = np
319 kkbig(1, 4 * j - 3) = 1.e20_r8
320 kkbig(1, 4 * j - 1) = 1.e20_r8
335 xjac = gpjac(ngr, ngs, n)
336 call
interpolation(0, psi(4 * (n1 - 1) + 1), psi(4 * (n2 - 1) &
337 + 1), psi(4 * (n3 - 1) + 1), psi(4 * (n4 - 1) + 1), r, s, ps)
339 arhs =
rh_side(a, x, 0._r8, 0._r8, 0._r8, 0._r8, ps, 0._r8, 0._r8)
344 nrow = 4 * (indices(nodeno(n, i)) - 1) + j
345 sumq = -arhs * h(j, i, ngr, ngs) * xjac
346 qq(nrow) = qq(nrow) - wr * ws * sumq
370 logical,
intent(in) :: first
372 integer(itm_i4) :: nd, nrow, nvar
373 integer(itm_i4) :: i, j, k
374 integer(itm_i4) :: info
375 integer(itm_i4) :: ik, ik2, ikn
376 integer(itm_i4) :: nbase, nbase2
377 logical,
parameter :: invert = .true.
382 nd = 4 * nr * (np - 1)
397 call dpbtrf(
'l', nd, nvar, kkbig, kklda, info)
400 psi(1 : 4 * nr * np) = qq
405 call dpbtrs(
'l', nd, nvar, 1, kkbig, kklda, psi, nrow, info)
409 qq = psi(1 : 4 * nr * np)
410 do i = 1, nr * (np - 1)
413 ikn = 4 * (inv_index(i) - 1) + k
419 ik = 4 * (i - 1) * np + k
420 ik2 = 4 * (i - 1) * np + 4 * (np - 1) + k
427 psi(4 * (i - 1) + 1) = psi(4 * (i - 1) + 1) + 1._r8
430 psi(4 * j - 3) = 1._r8
431 psi(4 * j - 1) = 0._r8
436 nbase = 4 * (i - 1) * np + k
437 nbase2 = nbase + 4 * (np - 1)
438 psi(nbase2) = psi(nbase)
456 real(r8),
intent(in) :: psaxis
458 integer(itm_i4) :: i, l
461 psi(4 * (i - 1) + 1) = 1._r8 - (1._r8 - psi(4 * (i - 1) + 1)) &
464 psi(4 * (i - 1) + l) = psi(4 * (i - 1) + l) / (1._r8 - psaxis)
subroutine interpolation(type_interp, xn1, xn2, xn3, xn4, r, s, x, xr, xs, xrs, xrr, xss, yn1, yn2, yn3, yn4, pn1, pn2, pn3, pn4, yr, ys, ps)
subroutine deallocate_solver
real(r8) function rh_side(a, x, xr, xs, yr, ys, psi, psir, F_dia)
subroutine cubic_interp_1d(x1, x1s, x2, x2s, s, x, xs)
subroutine normalize_psi(psaxis)
subroutine, public quad_equation(p_m, p_mr, p_p, p_pr, tol, r, ifail)
subroutine set_index(indices, inv)
subroutine axis_symm(psaxis, xaxis, yaxis, nax, rax, sax, n_start)
subroutine set_node_number(n_node, n1, n2, n3, n4)
subroutine build_matrix(a, first)
subroutine allocate_solver(nr, np)
subroutine mnewtax(ntrial, naxis, x, n, tolx, tolf, errx, errf)
subroutine find_axis(psaxis, xaxis, yaxis, nax, rax, sax)
subroutine gaussian_elimination(first)