35 INTEGER,
INTENT (INOUT) :: ifail
48 REAL (R8) :: rho(
solver%nrho)
53 REAL (R8) :: dy(
solver%nrho)
58 REAL (R8) :: g(
solver%nrho), h
61 REAL (R8) :: v(2), u(2), w(2)
68 REAL (R8) :: x(
solver%nrho)
70 REAL (R8) :: sol(
solver%nrho)
71 REAL (R8) :: dsol(
solver%nrho)
74 REAL (R8) :: cs(
solver%nrho)
76 REAL (R8) :: vs(2), us(2), ws(2)
93 equation_loop1:
DO idim = 1, ndim
95 flag =
solver%EQ_FLAG(idim)
98 IF (flag.EQ.0) goto 20
106 rho_loop1:
DO irho=1,nrho
107 rho(irho) =
solver%RHO(irho)
109 y(irho) =
solver%Y(idim,irho)
110 dy(irho) =
solver%DY(idim,irho)
111 ym(irho) =
solver%YM(idim,irho)
113 a(irho) =
solver%A(idim,irho)
114 b(irho) =
solver%B(idim,irho)
115 c(irho) =
solver%C(idim,irho)
116 d(irho) =
solver%D(idim,irho)
117 e(irho) =
solver%E(idim,irho)
118 f(irho) =
solver%F(idim,irho)
119 g(irho) =
solver%G(idim,irho)
153 IF(
solver%type .EQ. 1)
THEN
155 ELSE IF(
solver%type .EQ. 4)
THEN
158 write(*,*)
'Invalid solver%type = ',
solver%type
164 rho_loop2:
DO i = 1,n
166 as(i) = -e(i)/d(i) + dd(i)/d(i)
167 bs(i) = a(i)*c(i)/h/d(i) + c(i)*g(i)/d(i) + de(i)/d(i)
168 cs(i) = c(i)/d(i) * (f(i) + b(i)*ym(i)/h)
182 CALL
solver_ritm(x,n, vs,us,ws, as,bs,cs, sol,dsol, isp)
186 rho_loop3:
DO irho = 1,nrho
189 y(irho) = y(irho)*(1.e0_r8-amix) + sol(irho)*amix
190 dy(irho) = dy(irho)*(1.e0_r8-amix) + dsol(irho)*amix
195 solver%Y(idim,irho) = y(irho)
196 solver%DY(idim,irho) = dy(irho)
205 END DO equation_loop1
236 SUBROUTINE solver_ritm(X,N, V,U,W, A,B,C, SOL,DSOL, ISP)
249 INTEGER,
INTENT (INOUT) :: isp
253 REAL (R8) :: x(n), x1(n-1)
255 REAL (R8) :: a(n), b(n), c(n)
256 REAL (R8) :: a1(n), b1(n), c1(n)
258 REAL (R8) :: v(2), u(2), w(2)
259 REAL (R8) :: v1(2), u1(2), w1(2)
261 REAL (R8) :: sol(n), dsol(n)
262 REAL (R8) :: sol1(n), dsol1(n)
264 REAL (R8) :: e, f, k1, k2
267 IF (x(1).EQ.0.e0_r8.AND.u(1).EQ.0.e0_r8.AND.w(1).EQ.0.e0_r8)
THEN
278 k1 = 2.e0_r8 + 2.0*a1(1)*x1(1) - b1(1)*x1(1)**2
279 k2 = 2.e0_r8 + 2.0*a1(2)*x1(2) - b1(2)*x1(2)**2
281 f = - (c1(1)*b1(2)-c1(2)*b1(1)) / (k1*b1(2)-k2*b1(1))
282 e = (f*k1+ c1(1))/b1(1)
285 v1(1) = 1.e0_r8/x1(1) - a1(1)
288 ELSE IF (isp.EQ.1)
THEN
291 w1(1) = 1.e0_r8 * f * x1(1)
299 CALL
solver_ritm1(x1,n1, v1,u1,w1, a1,b1,c1, sol1,dsol1, isp)
311 CALL
axis1(n, x, sol)
312 ELSE IF (isp.EQ.1)
THEN
318 ELSE IF (x(1).NE.0.e0_r8)
THEN
320 CALL
solver_ritm1(x,n, v,u,w, a,b,c, sol,dsol, isp)
351 SUBROUTINE solver_ritm1(x,n, v,u,w, a,b,f, y,d, isp)
371 REAL (R8) :: a(n),b(n),f(n)
372 REAL (R8) :: u(2),v(2),w(2)
375 REAL (R8) :: y(n),d(n)
378 INTEGER :: i,l,m,mn,k,j,jm,ii
380 REAL (R8) :: h(0:n+1)
382 REAL (R8) :: y0(n,3),d0(n,3),y1(n,2,3),d1(n,2,3),s1(n,2,3)
383 REAL (R8) :: cs(n,2,2),zt(n,2),et(n,2,2,2),mu(n,2,2),c(n,2)
384 REAL (R8) :: asi,arg,ay,cy,by,dy,bf,df,s,si,de,xi,af,cf,det
410 IF(i.EQ.2.OR.i.EQ.n-1) jm=2
413 IF(i.EQ.2.AND.j.EQ.2) ii=1
414 IF(i.EQ.n-1.AND.j.EQ.2) ii=n
419 ay=(af*arg+cf*asi)/(arg**2+asi**2)
420 cy=(cf*arg-af*asi)/(arg**2+asi**2)
424 by=(bf*arg+df*asi)/(arg**2-asi**2)
425 dy=(df*arg+bf*asi)/(arg**2-asi**2)
427 s=(-1)**l*si*h(i+l-2)/2.e0_r8
428 IF(i.EQ.2.AND.j.EQ.2)
THEN
429 IF(l.EQ.1) s=-si*h(1)
430 IF(l.EQ.2) s=-si*h(1)/2.e0_r8
432 IF(i.EQ.n-1.AND.j.EQ.2)
THEN
433 IF(l.EQ.1) s=si*h(n-1)/2.e0_r8
434 IF(l.EQ.2) s=si*h(n-1)
436 y0(ii,l)=ay*cos(s)+cy*sin(s)+ &
437 by*cosh(s)+dy*sinh(s)
438 d0(ii,l)=si*(-ay*sin(s)+cy*cos(s)+ &
439 by*sinh(s)+dy*cosh(s))
441 IF(j.EQ.1) y0(i,3)=ay+by
443 IF(i.EQ.2) y0(1,3)=y0(1,1)
444 IF(i.EQ.n-1) y0(n,3)=y0(n,2)
451 de=a(i)**2/4.e0_r8+b(i)
453 lam=(-1)**k*sqrt(max(0.e0_r8,de))-a(i)/2.e0_r8
454 IF(abs(b(i)).LT.1.e-10_r8*a(i)**2/4.e0_r8) &
455 lam=-a(i)*(2.e0_r8-k)+b(i)/a(i)*(k-1.e0_r8)
457 s=(-1)**l*h(i+l-2)/2.e0_r8
458 IF(i.EQ.1.AND.l.EQ.1.OR.i.EQ.n.AND.l.EQ.2.OR.l.EQ.3) &
460 y1(i,k,l)=exp(s*lam-(h(i-1)*(abs(lam)-lam)+ &
461 h(i)*(abs(lam)+lam))/4.e0_r8)/(1.e0_r8+(sqrt(max &
462 (0.e0_r8,de))+abs(a(i)/2.e0_r8))*(h(i-1)+h(i))/2.e0_r8)
464 IF(de.EQ.0.e0_r8)
THEN
465 xi=(k-1.e0_r8)*(x(i)+s)
466 y1(i,k,l)=y1(i,k,l)*(1.e0_r8+xi/(abs(x(1))+abs(x(n))))
467 s1(i,k,l)=lam+(k-1.e0_r8)/(abs(x(1))+abs(x(n))+xi)
469 IF(de.LT.0.e0_r8)
THEN
470 xi=(-1)**k*tan(sqrt(-de)*s)
471 y1(i,k,l)=y1(i,k,l)*cos(sqrt(-de)*s)*(1.e0_r8+xi)
472 s1(i,k,l)=lam+sqrt(-de)*(-1)**k*(1.e0_r8-xi)/(1.e0_r8+xi)
474 d1(i,k,l)=y1(i,k,l)*s1(i,k,l)
486 cs(mn,k,m)=u(m)+v(m)*s1(mn,k,m)
488 zt(mn,m)=(w(m)-u(m)*y0(mn,m)-v(m)*d0(mn,m))
489 det=max(1.e0_r8,abs(cs(mn,1,m)),abs(cs(mn,2,m)))
490 IF(det.GT.0.e0_r8)
THEN
492 cs(mn,k,m)=cs(mn,k,m)/det
494 zt(mn,m)=zt(mn,m)/det
496 DO i=mn,(n-1)*(2-m)+2*(m-1),-(-1)**m
500 et(i,k,l,m)=(-1)**l*(s1(j,k,m)- &
501 s1(i,3-l,3-m))/(s1(i,2,3-m)-s1(i,1,3-m))
503 mu(i,l,m)=(-1)**l*(d0(j,m)-d0(i,3-m)-(y0(j,m)-y0(i,3-m))* &
504 s1(i,3-l,3-m))/(s1(i,2,3-m)-s1(i,1,3-m))
507 cs(j,k,m)=et(i,k,1,m)*y1(i,1,m)*y1(i,2,3-m)* &
508 cs(i,1,m)+et(i,k,2,m)*y1(i,1,3-m)*y1(i,2,m)*cs(i,2,m)
510 zt(j,m)=(zt(i,m)*y1(i,1,3-m)*y1(i,2,3-m)- &
511 mu(i,1,m)*y1(i,1,m)*y1(i,2,3-m)*cs(i,1,m)- &
512 mu(i,2,m)*y1(i,1,3-m)*y1(i,2,m)*cs(i,2,m))
513 det=max(abs(cs(j,1,m)),abs(cs(j,2,m)))
514 IF(det.GT.0.e0_r8)
THEN
516 cs(j,k,m)=cs(j,k,m)/det
526 c(i,k)=(zt(i,k)*y1(i,j,j)*cs(i,j,j)- &
527 zt(i,j)*y1(i,j,k)*cs(i,j,k))/ &
528 (y1(i,1,1)*y1(i,2,2)*cs(i,1,1)*cs(i,2,2)- &
529 y1(i,1,2)*y1(i,2,1)*cs(i,1,2)*cs(i,2,1))
531 y(i)=c(i,1)*y1(i,1,3)+c(i,2)*y1(i,2,3)+y0(i,3)
532 d(i)=c(i,1)*d1(i,1,3)+c(i,2)*d1(i,2,3)+d0(i,3)
539 d(i)=((y(i)-y(i-1))*h(i)/h(i-1)+ &
540 (y(i+1)-y(i))*h(i-1)/h(i))/(h(i-1)+h(i))
544 d(n)=((y(n)-y(n-1))*(h(n-2)/h(n-1)+2.e0_r8)- &
545 (y(n-1)-y(n-2))*h(n-1)/h(n-2))/(h(n-2)+h(n-1))
573 REAL (R8) :: x(n), f(n)
574 REAL (R8) :: a, b, c, d, l
575 REAL (R8) :: l1,s1,s2,cs,ga
577 s1=2.e0_r8*(x(i)-x(i-1))/(x(i+1)-x(i-1))
580 IF(f(i).EQ.0.e0_r8) goto 30
581 cs=(f(i+1)*s1+f(i-1)*s2)/f(i)/2.e0_r8
584 IF(1.e0_r8+1.e-7_r8.LT.cs.AND.cs.LE.2.e0_r8)
THEN
586 ga=cosh(l)*(f(i-1)/sinh(l*s1)+f(i+1)/sinh(l*s2))/ &
587 (f(i)/tanh(l*s1)+f(i)/tanh(l*s2))
588 l=log(ga+sqrt(ga*ga-1.e0_r8))
589 IF(abs(l).GE.1.e0_r8) goto 30
590 IF(s1.NE.s2.AND.abs(1.e0_r8-l1/l).GT.1.e-5_r8) goto 10
594 d=(f(i+1)*cosh(l*s1)-f(i-1)*cosh(l*s2))/sinh(2.e0_r8*l)
598 IF(-.5e0_r8.LE.cs.AND.cs.LT.1.e0_r8-1.e-7_r8)
THEN
600 ga=(f(i-1)*sin(l*s2)+f(i+1)*sin(l*s1))/2.e0_r8/f(i)/sin(l)
602 IF(abs(l).GE.1.e0_r8) goto 30
603 IF(s1.NE.s2.AND.abs(1.e0_r8-l1/l).GT.1.e-5_r8) goto 20
606 c=(f(i+1)*cos(l*s1)-f(i-1)*cos(l*s2))/sin(2.e0_r8*l)
612 a=(f(i+1)*(sin(s1)+sinh(s1))+f(i-1)*(sin(s2)+sinh(s2))- &
613 f(i)*(sin(s1)*cosh(s2)+sin(s2)*cosh(s1)+sinh(2.e0_r8)))/ &
614 (sin(2.e0_r8)+cos(s2)*sinh(s1)+cos(s1)*sinh(s2)- &
615 sin(s1)*cosh(s2)-sin(s2)*cosh(s1)-sinh(2.e0_r8))
617 c=(f(i+1)-f(i-1)+a*(cos(s1)-cos(s2))+b*(cosh(s1)- &
618 cosh(s2)))/(sin(s1)+sinh(s1)+sin(s2)+sinh(s2))
621 40 l=2.e0_r8*l/(x(i+1)-x(i-1))
652 REAL (R8) :: h(n),dy2(n)
659 dy1(i)=((y(i+1)-y(i))*h(i-1)/h(i)+(y(i)-y(i-1))*h(i)/h(i-1)) &
661 dy2(i)=2.e0_r8*((y(i-1)-y(i))/h(i-1)+(y(i+1)-y(i))/h(i)) &
665 dy1(1)=dy1(2)-dy2(2)*h(1)
666 dy1(n)=dy1(n-1)+dy2(n-1)*h(n-1)
698 REAL *8 h(n), r(n), f(n)
708 f(1) = ((f(2)*r(4)/h(2)+f(4)*r(2)/h(3))*r(3) &
709 -f(3)*(r(2)/h(2)+r(4)/h(3))*r(2)*r(4)/r(3)) &
subroutine solution1(SOLVER, ifail)
This subroutine is prepared to solve single transport equation in standardised form adopted by the ET...
subroutine derivn1(N, X, Y, DY1)
These subroutines calculate first and second derivatives, DY1 and DY2, of function Y respect to argum...
subroutine solver_ritm1(x, n, v, u, w, a, b, f, y, d, isp)
This subroutine provides solution for the equation Y''(x)+a(x)*Y'(x)=b(x)*Y(x)-f(x) with boundary con...
subroutine hyp_trig_spline1(i, n, x, f, a, b, c, d, l)
This subroutine interpolates the experimental data by using qubic spline so that k additional points ...
subroutine solver_ritm(X, N, V, U, W, A, B, C, SOL, DSOL, ISP)
This is interface for RITM solver, which allows to use the solver on grids starting from zero...
subroutine axis1(n, r, f)
This subroutine finds f(r_1=0) from f(r_2), f(r_3) and f(r_4)