ETS  \$Id: Doxyfile 2162 2020-02-26 14:16:09Z g2dpc $
 All Classes Files Functions Variables Pages
solc.f
Go to the documentation of this file.
1 C***************************************************************
2 C SUBROUTINE "EVSLV" SOLVES THE MATRIX CIRCUIT EQUATION
3 C***************************************************************
4 C INPUT DATE:
5 C **********
6 C NLES, NREG, TSTEP0, TSTEP, SIGM, NJ,
7 C VOLK(NJ), VOLKP1(NJ), RES(NJ),
8 C PSPK(NJ), PSPKP1(NJ), CRPK(NJ), CRPKP1(NJ), CRPKP(NJ),
9 C NOUT, NTER, KEYPRI,
10 C
11 C PPIND(NJ,NJ) - from 'comevl.inc'
12 C DPSIDJ(NJ,NJ) - from 'comevl.inc' only for NREG=1
13 C
14 C
15 C OUTPUT DATE:
16 C ***********
17 C CRPKP1(NJ) - solution array - currents
18 C EREVE - "nevyazka" of circuit equation solution
19 C ( without DPSIDJ*(CRPKP1 - CRPKP) term )
20 C***************************************************************
21 C
22  SUBROUTINE evslv( NLES, NREG, TSTEP0, TSTEP, SIGM,
23  * nj, volk, volkp1, res,
24  * pspk, pspkp1, crpk, crpkp1, crpkp,
25  * nout, nter, keypri, ereve )
26 
27  IMPLICIT REAL*8( a-h, o-z )
28 
29  include 'prm.inc'
30  include 'comevl.inc'
31 
32  dimension bz(njlim)
33 
34  !DIMENSION RES(*), VOLK(*), VOLKP1(*)
35  !DIMENSION PSPK(*), PSPKP1(*)
36  !DIMENSION CRPK(*), CRPKP1(*), CRPKP(*)
37 
38  dimension res(njlim), volk(njlim), volkp1(njlim)
39  dimension pspk(njlim), pspkp1(njlim)
40  dimension crpk(njlim), crpkp1(njlim), crpkp(njlim)
41 
42  REAL*8 a(nnlim), rsp(nsp), b(njlim)
43  INTEGER pp(njlim), p(njlim), ip(njlim),
44  * ia(njlim1), ja(nnlim), isp(nsp)
45 
46  COMMON /spa_mat/ a, ia, ja
47  COMMON /sparsp/ rsp, pp, p, ip
48 
49  equivalence(rsp(1),isp(1))
50 
51 C***************************************************************
52 
53  abs(xxx) = dabs(xxx)
54  nflag=0
55  nn = nj * nj
56 C---------------------------------------------------------------
57 
58  IF( nles.EQ.0 ) THEN
59  npath = 1
60 
61  DO i=1,nj
62  pp(i) = i
63  p(i) = i
64  ip(i) = i
65  enddo
66 
67  ia(1) = 1
68  DO i=2,nj
69  ia(i) = ia(i-1) + nj
70  enddo
71  ia(nj+1) = nn+1
72 
73  DO 3 i=1,nj
74  ia1 = ia(i)
75  ia2 = ia(i+1) - 1
76  DO 4 j=ia1,ia2
77  jaj = j - ia1 + 1
78  ja(j) = jaj
79  a(j) = ppind(i,jaj)
80  IF( nreg.EQ. 1 ) a(j) = a(j) + dpsidj(i,jaj)
81  IF( i .EQ.jaj ) a(j) = a(j) + tstep*sigm*res(i)
82  4 CONTINUE
83 C
84  3 CONTINUE
85  END IF
86 C--------------------------------------------------------------------
87 C
88  IF( nles.EQ.1 ) THEN
89  npath = 1
90  DO 10 i=1,nj
91  ia1 = ia(i)
92  ia2 = ia(i+1) - 1
93  DO 11 j=ia1,ia2
94  jaj = ja(j)
95  a(j) = ppind(i,jaj)
96  IF( nreg.EQ. 1 ) a(j) = a(j) + dpsidj(i,jaj)
97  IF( i .EQ.jaj ) a(j) = a(j) + tstep*sigm*res(i)
98  11 CONTINUE
99  10 CONTINUE
100  END IF
101 C--------------------------------------------------------------------
102 C
103  IF( nles.EQ.2 ) THEN
104  npath = 3
105  !NPATH = 1
106  END IF
107 C--------------------------------------------------------------------
108 C
109  IF((nles.NE.0).AND.(nles.NE.1).AND.(nles.NE.2)) THEN
110  WRITE(*,*) 'PARAMETER NLES = ', nles
111  WRITE(*,*) 'IT IS WRONG. PROGRAM INTERRUPT'
112  stop
113  END IF
114 C******************************************************************
115 
116  DO 6 i=1,nj
117 
118  rs1 = 0.d0
119  rs2 = 0.d0
120  DO 7 j=1,nj
121  rs1 = rs1 + crpk(j) * ppind(i,j)
122  IF( nreg.EQ.1 ) rs2 = rs2 + crpkp(j) * dpsidj(i,j)
123  7 CONTINUE
124 
125  b(i) = - tstep*res(i)*(1.d0-sigm)*crpk(i)
126  * + tstep*(sigm*volkp1(i)+(1.d0-sigm)*volk(i))
127  * + rs1
128  * - (pspkp1(i) - pspk(i)) * tstep/tstep0
129 
130  IF( nreg.EQ.1 ) b(i) = b(i) + rs2
131 
132  bz(i) = b(i)
133 
134  6 CONTINUE
135 
136 C******************************************************************
137 
138 
139  call sdrvd(nj,p,ip,ia,ja,a,b,crpkp1,nsp,
140  * isp,rsp,nesp,npath,nflag)
141 
142 
143 
144 ! CALL CDRVD( NJ, PP,P,IP, IA,JA,A, B,CRPKP1,
145  ! * NSP,ISP,RSP, NESP,NPATH,NFLAG )
146 C
147 C. WRITE(NOUT,*) '****************************************** '
148 C. WRITE(NOUT,*) 'FROM SUBROUTINE "EVSLV" AFTER "CALL CDRVD" '
149 C. WRITE(NOUT,*) 'NSP =',NSP,' ESP =',NESP,' FLAF =',NFLAG
150 C. WRITE(NOUT,*) 'PATH =',NPATH,' NLES =',NLES
151 C. WRITE(NOUT,*) 'NREG =',NREG
152 C
153 C CALL TCONTR( 0, A,JA,IA,NJ,CRPKP1,B, 0,0, BZ, ERR)
154 C
155 C IF( KEYPRI.EQ.1 ) THEN
156 C WRITE(NOUT,*) 'NEVYAZKA OF LINEAR SYSTEM: ERR =', ERR
157 C WRITE(NTER,*) 'NEVYAZKA OF LINEAR SYSTEM: ERR =', ERR
158 C END IF
159 C
160  ereve = 0.0d0
161  DO 66 i=1,nj
162 C
163  rs1 = 0.d0
164  DO 777 j=1,nj
165  rs1 = rs1 + (crpkp1(j) - crpk(j)) * ppind(i,j)
166  777 CONTINUE
167 C
168  bzz = - res(i)*tstep*(1.d0 - sigm)* crpk(i)
169  * - res(i)*tstep* sigm * crpkp1(i)
170  * + tstep*(1.d0 - sigm)* volk(i)
171  * + tstep* sigm * volkp1(i)
172  * - rs1
173  * - (pspkp1(i) - pspk(i)) * tstep / tstep0
174 C
175  ttt = abs(bzz)
176  IF( ttt.GT.ereve ) ereve = ttt
177  66 CONTINUE
178 C
179 C IF( KEYPRI.EQ.1 ) THEN
180 C WRITE(NOUT,*) 'NEVYAZKA OF EVOL. EQUATION: EREVE =', EREVE
181 C WRITE(NOUT,*) '****************************************** '
182 C END IF
183 C WRITE(NTER,*) 'NEVYAZKA OF EVOL. EQUATION: EREVE =', EREVE
184 C WRITE(NTER,*) '****************************************** '
185 C
186  IF( nesp.LT.0 ) THEN
187  WRITE(*,*) 'ATTENTION ESP(SDRVD) = ', nesp
188  WRITE(*,*) 'IT IS WRONG. PROGRAM INTERRUPT'
189  !WRITE(NOUT,*) 'PARAMETER PATH(SDRVD) = ', NPATH
190  !WRITE(NTER,*) 'ATTENTION ESP(SDRVD) = ', NESP
191  !WRITE(NTER,*) 'IT IS WRONG. PROGRAM INTERRUPT'
192  !WRITE(NTER,*) 'PARAMETER PATH(SDRVD) = ', NPATH
193  stop
194  END IF
195  IF( nflag.NE.0 ) THEN
196  WRITE(*,*) 'ATTENTION FLAG(SDRVD) = ', nflag
197  WRITE(*,*) 'IT IS WRONG. PROGRAM INTERRUPT'
198  !WRITE(NOUT,*) 'PARAMETER PATH(SDRVD) = ', NPATH
199  !WRITE(NTER,*) 'ATTENTION FLAG(SDRVD) = ', NFLAG
200  !WRITE(NTER,*) 'IT IS WRONG. PROGRAM INTERRUPT'
201  !WRITE(NTER,*) 'PARAMETER PATH(SDRVD) = ', NPATH
202  stop
203  END IF
204 C
205  RETURN
206  END
207 C***************************************************************
subroutine evslv(NLES, NREG, TSTEP0, TSTEP, SIGM, NJ, VOLK, VOLKP1, RES, PSPK, PSPKP1, CRPK, CRPKP1, CRPKP, NOUT, NTER, KEYPRI, EREVE)
Definition: solc.f:22
real(r8) function p(a, x, xr, xs, yr, ys, psi, psir, F_dia)
subroutine sdrvd
Definition: SPAR.f:1411