ETS  \$Id: Doxyfile 2162 2020-02-26 14:16:09Z g2dpc $
 All Classes Files Functions Variables Pages
Trecur_2.f
Go to the documentation of this file.
1 C***********************************************************************
2 C SUBROUTINE FOR READING AND TREATMENT
3 C PFC PARAMETERS ( THEIR POSITIONS, CURRENTS, RESISTANCE,
4 C NUMBER OF TURNS, NUMBER OF DIVIDING,
5 C EQUIVALENT SIGNS )
6 C***********************************************************************
7 C OUTPUT DATE:
8 C ----------
9 C NPFC - NUMBER OF PF-COILS
10 C
11 C PFCUR1(L) - VALUES OF TOTAL CURRENT OF PFC CROSS-SECTION (in MA)
12 C L = 1,2,...,NPFC
13 C NEPFC(L) - EQUIVALENT "SIGNS" OF PF-COILS
14 C L = 1,2,...,NPFC
15 C WEPFC(L) - EQUIVALENT "WEIGHTS" OF PF-COILS
16 C L = 1,2,...,NPFC
17 C NTURN(L) - NUMBER OF REAL TURNS OF PF-COILS
18 C L = 1,2,...,NPFC
19 C NDIV(L) - NUMBER OF DIVIDING TURNS OF PF-COILS
20 C L = 1,2,...,NPFC
21 C NLOC(L) - LOCATION ARRAY OF DIVIDING TURNS OF PF-COILS
22 C
23 C !!! L = 0,1,2,...,NPFC !!! :
24 C NLOC(0) = 0, NLOC(1) = NDIV(1),
25 C NLOC(2) = NDIV(1) + NDIV(2),...,
26 C NLOC(NPFC) = NDIV(1) + NDIV(2) +...+ NDIV(NPFC) = NCPFC
27 C ---------------------------------------------------------------------
28 C NEQUI - NUMBER OF EQUIVALENT PF-COIL GROUPS ( NEQUI .LE. NPFC )
29 C
30 C PFRES(L) - RESISTANCE OF EQUIVALENT PF-COIL GROUPS; in [micro*Ohm]
31 C L = 1,2,...,NEQUI
32 C PFVOL1(L) - VOLTAGE OF EQUIVALENT PF-COIL GROUPS; in [V]
33 C L = 1,2,...,NEQUI
34 C PFCEQW(L) - CURRENT OF EQUIVALENT PF-COIL GROUPS; in [MA]
35 C L = 1,2,...,NEQUI
36 C ---------------------------------------------------------------------
37 C NCPFC - NUMBER OF PFC-CURRENTS (AFTER DIVIDING)
38 C
39 C PC(L) - VALUES (IN MA) OF PFC-CURRENTS (AFTER DIVIDING)
40 C L=1,...,NCPFC.
41 C RI(L),ZI(L) - CILINDER COORDINATES (IN M) OF PFC-CURRENTS
42 C (AFTER DIVIDING) L = 1,2,...,NCPFC
43 C NTYPE(L) - NUMBER OF TYPE OF PFC-CURRENT CROSS-SECTIONS
44 C (AFTER DIVIDING) L = 1,2,...,NCPFC
45 C VERS(L) - VERTICAL SIZE OF PFC-CURRENT CROSS-SECTIONS
46 C (AFTER DIVIDING) L = 1,2,...,NCPFC
47 C HORS(L) - HORIZONTAL SIZE OF PFC-CURRENT CROSS-SECTIONS
48 C (AFTER DIVIDING) L = 1,2,...,NCPFC
49 C NECON(L) - EQUIVALENT "SIGNS" OF PF-CURRENTS
50 C (AFTER DIVIDING) L = 1,2,...,NCPFC
51 C WECON(L) - EQUIVALENT "WEIGHTS" OF PF-CURRENTS
52 C (AFTER DIVIDING) L = 1,2,...,NCPFC
53 C
54 C***********************************************************************
55 C
56  SUBROUTINE trecur( NCPFC, RI, ZI, PC, NTYPE, NECON, WECON,
57  * hors, vers, npri, nter )
58 C
59  include 'double.inc'
60 C
61  include 'prm.inc'
62  include 'comevl.inc'
63 C
64  dimension ri(*), zi(*), pc(*), hors(*), vers(*), wecon(*)
65  INTEGER ntype(*), necon(*)
66 C
67 C WORK ARRAYS
68  dimension rs(700), zs(700), delz(300), delr(300)
69  INTEGER ndw(300), ndh(300)
70 C
71 C***********************************************************************
72 C
73  ninp = 1
74 C
75  !WRITE(NPRI,*) ' '
76  !WRITE(NPRI,*) '**************************************'
77  !WRITE(NPRI,*) '*** ENTRANCE OF SUBROUT. TRECUR ***'
78 C-------------------------------------
79  write(fname,'(a,a)') path(1:kname),'coilres.dat'
80  open(ninp,file=fname,form='formatted')
81  !open(ninp, file='coilres.dat')
82 C
83  READ(ninp,*) nequi
84 C
85  !WRITE(NPRI,*) '**************************************'
86  !WRITE(NPRI,*) ' NUMBER OF EQUIV. COIL GROUPS NEQUI =', NEQUI
87  !WRITE(NPRI,*) '**************************************'
88 C
89  DO 288 i=1,nequi
90  READ(ninp,*) l
91  READ(ninp,*) pfres(l)
92 C+++ PFVOL1(L) = 0.d0 now it's located below
93  288 CONTINUE
94 C
95  close(ninp)
96 C-------------------------------------
97  write(fname,'(a,a)') path(1:kname),'coil.dat'
98  open(1,file=fname,form='formatted')
99  !open(1, file='coil.dat')
100  !open(ninp, file='coil.dat')
101 C
102  ! READ(NINP,*) NPFC, KEYCUR
103  READ(1,*) npfc, keycur
104 
105 
106 c print *,' npfc ==',npfc
107 c read (*,*)
108 
109 C
110  !WRITE(NPRI,*) '**************************************'
111  !WRITE(NPRI,*) ' NUMBER OF PF-COILS NPFC =', NPFC
112  !WRITE(NPRI,*) ' KEY OF CURRENT DEFINITION KEYCUR =', KEYCUR
113  !WRITE(NPRI,*) '**************************************'
114 C
115  11 FORMAT(/,2x,i3,2x,5e14.7)
116  16 FORMAT(7x,i3,11x,2e14.7,e12.4,2x,i7)
117  10 FORMAT(/,3x,'NUM.',2x,'RC (M)',8x,'ZC (M)',8x,'WC (M)',
118  * 8x,'HC (M)', 8x,'CURRENT (MA)')
119  15 FORMAT( 9x,'NDI ',10x,'AWC',11x,'AHC',11x,'NTURN ',
120  * 7x,' PF-COIL SIGN ')
121 C
122  !WRITE(NPRI,*) '**************************************'
123  !WRITE(NPRI,*) '*** PFC INPUT INFORMATION ***'
124  !WRITE(NPRI,10)
125  !WRITE(NPRI,15)
126 C
127 C*****************************************************
128 C
129  ncpfc = 0
130  nloc(0) = 0
131 C
132  DO 2 i=1,npfc
133 C
134  !READ(NINP,*) NDI
135  READ(1,*) ndi
136  !READ(NINP,*) RC,ZC, WC,HC, AWC,AHC, PFCUR1(I), NTURN(I), NEPFC(I)
137  READ(1,*) rc,zc, wc,hc, awc,ahc, pfcur1(i), nturn(i), nepfc(i)
138  ntipe = 2
139 C------------------------------------------------------
140 C EXPERIMENT FOR TCV PF FAST COILS (numbers 24,...,29)
141 C+++ IF( I.GE.24 ) NTIPE = 3
142 C------------------------------------------------------
143 C
144  IF( keycur .EQ. 1 ) pfcur1(i) = pfcur1(i) * nturn(i)
145 C
146  !WRITE(NPRI,11) I, RC, ZC, WC, HC, PFCUR1(I)
147  !WRITE(NPRI,16) NDI, AWC, AHC, NTURN(I), NEPFC(I)
148 C
149  CALL divpar( rc, zc, wc, hc, awc, ahc, pfcur1(i), ndi,
150  * ndivre, ndivw, ndivh, rs, zs, ps, verc, horc )
151 C
152  ndiv(i) = ndivre
153  wepfc(i) = nturn(i) / ndiv(i)
154 C
155  pfcur2(i) = pfcur1(i)
156  pfcw1(i) = pfcur1(i) / nturn(i)
157  pfcd1(i) = pfcur1(i) / ndiv(i)
158 C
159  DO 3 j=1,ndivre
160  l = ncpfc + j
161  ri(l) = rs(j)
162  zi(l) = zs(j)
163  pc(l) = pfcd1(i)
164  hors(l) = horc
165  vers(l) = verc
166  ntype(l) = ntipe
167  necon(l) = nepfc(i)
168  wecon(l) = wepfc(i)
169  3 CONTINUE
170 C
171  ncpfc = ncpfc + ndivre
172  nloc(i) = ncpfc
173 C
174  ndw(i) = ndivw
175  ndh(i) = ndivh
176  delz(i) = verc
177  delr(i) = horc
178 C
179  2 CONTINUE
180 
181 ! open(1,file='pfc_nturn.wr',form='formatted')
182 ! do i=1,NPFC
183 ! write(1,'(e13.5)' ) PFCUR2(I)
184 ! enddo
185 ! pause 'pfc_nturn.wr'
186 
187 C
188  !close(ninp)
189  close(1)
190 C
191  DO 4 i=1,nequi
192 
193  DO 5 j=1,npfc
194 C
195  IF( nepfc(j) .EQ. i ) THEN
196  pfceqw(i) = pfcw1(j)
197  go to 5
198  END IF
199 C
200  5 CONTINUE
201 C
202 C [Volt] = [micro*Ohm]*[mega*Amper]
203 C
204 C+++ PFVOL1(I) = 0.d0
205  pfvol1(i) = pfres(i)*pfceqw(i)
206 
207  4 CONTINUE
208 C
209 C*****************************************************
210 C
211  !WRITE(NPRI,*) '**************************************'
212  !WRITE(NPRI,*) 'EQ.SIGN NUM. => PFRES(L), PFVOL1(L), PFCEQW(L)'
213  4444 FORMAT(2x,i8,4x,e13.6,5x,e13.6,5x,e13.6)
214 C
215  !DO 1937 L=1,NEQUI
216  !WRITE(NPRI,4444) L, PFRES(L), PFVOL1(L), PFCEQW(L)
217  !1937 CONTINUE
218 C---------------------------------------------------------------------
219 C
220  42 FORMAT(/,2x,'PFC NUM.',4x,'PFC SIGN',6x,'PFC WEIGHT ',
221  * 5x,'TURN CURRENT' )
222  44 FORMAT(2x,i8,4x,i8,5x,e13.6,5x,e13.6)
223 C
224  !WRITE(NPRI,*) '**************************************'
225  !WRITE(NPRI,*) '*** PFC TURN CURRENT INFORMATION ***'
226  !WRITE(NPRI,42)
227 C
228  !DO 41 I=1,NPFC
229  !WRITE(NPRI,44) I, NEPFC(I), WEPFC(I), PFCW1(I)
230  !41 CONTINUE
231 C*****************************************************
232 C
233  12 FORMAT(/,2x,'NUM.',2x,'NDIVRE',2x,'NDIVW',2x,'NDIVH',2x,
234  * 'CELL CURRENT',4x,'CELL Z-SIZE',4x,'CELL R-SIZE')
235  14 FORMAT(2x,i3,2x,i6,2x,i5,2x,i5,2x,e13.5,2x,e13.5,2x,e13.5)
236 C
237  !WRITE(NPRI,*) '**********************************************'
238  !WRITE(NPRI,*) '*** DIVIDING PROCEDURE RESULTS INFORMATION ***'
239  !WRITE(NPRI,12)
240  !WRITE(NTER,*) '**********************************************'
241  !WRITE(NTER,*) '*** DIVIDING PROCEDURE RESULTS INFORMATION ***'
242  !WRITE(NTER,12)
243 C
244 ! DO 444 I=1,NPFC
245 ! WRITE(NPRI,14) I, NDIV(I), NDW(I), NDH(I), PFCD1(I),
246 ! * DELZ(I), DELR(I)
247 ! WRITE(NTER,14) I, NDIV(I), NDW(I), NDH(I), PFCD1(I),
248 ! * DELZ(I), DELR(I)
249 ! 444 CONTINUE
250 C
251  !WRITE(NTER,*) '**************************************'
252  !WRITE(NTER,*) '*** NUMBER OF MAT. PFC-CURR. NCPFC =', NCPFC
253  !WRITE(NTER,*) ' '
254  !WRITE(NPRI,*) '**************************************'
255  !WRITE(NPRI,*) '*** NUMBER OF MAT. PFC-CURR. NCPFC =', NCPFC
256  !WRITE(NPRI,*) ' '
257 C
258  111 FORMAT( 2x, 10i5 )
259  222 FORMAT( 2x, 7e11.4 )
260  !WRITE(NPRI,*) '***** NECON(I), I=1,NCPFC =', NCPFC,'*****'
261 C+++ WRITE(NPRI,111) ( NECON(I), I=1,NCPFC )
262  !WRITE(NPRI,*) '***** WECON(I), I=1,NCPFC =', NCPFC,'*****'
263 C+++ WRITE(NPRI,222) ( WECON(I), I=1,NCPFC )
264 C*****************************************************
265 C
266  !WRITE(NPRI,*) '**************************************'
267  !WRITE(NPRI,*) '*** EXIT FROM SUBROUT. TRECUR ***'
268  !WRITE(NPRI,*) '**************************************'
269  !WRITE(NPRI,*) ' '
270 C
271  RETURN
272  END
273 C**************************************************************
274 C SUBROUTINE FOR DIVIDING OF PARALLELOGRAM
275 C ( FOR PFC CROSS-SECTION )
276 C**************************************************************
277 C INPUT DATE:
278 C ----------
279 C RC,ZC - CILINDER COORDINATES OF CENTER OF PARALLELOGRAM
280 C WC - PROJECTION OF THE FIRST SIDE OF PARALLELOGRAM
281 C ON AXIS "R" (IN METER)
282 C HC - PROJECTION OF THE SECOND SIDE OF PARALLELOGRAM
283 C ON AXIS "Z" (IN METER)
284 C AWC - ANGLE BETWEEN THE FIRST SIDE OF PARAL. AND
285 C AXIS "R" (IN DEGREES, IT MUST NOT BE EQUAL 90 ,
286 C IT MUST BE : -90 < AWC < 90 )
287 C AHC - ANGLE BETWEEN THE SECOND SIDE OF PARAL. AND
288 C AXIS "R" (IN DEGREES, IT MUST NOT BE EQUAL 0 ,
289 C IT MUST BE : 0 < AHC < 180 )
290 C CURC - CURRENT OF PARALLELOGRAM (IN MA)
291 C NDIV - APPROXIMATE NUMBER OF CELLS OF DIVIDING:
292 C NDIV=0 - A SPECIAL CASE: AUTOMATICALLY NDIVRE=1,
293 C RS(1)=RC, ZS(1)=ZC, PS=CURC
294 C IF NDIV > 0 THEN WE HAVE THE MOST TOTAL ALGORITHM OF
295 C DIVIDING
296 C IF NDIV < 0 THEN NDIVW AND NDIVH ARE CUT OFF BY ABS(NDIV)
297 C
298 C OUTPUT DATE:
299 C ----------
300 C NDIVRE - REAL NUMBER OF CELLS OF DIVIDING ( = NDIVW*NDIVH )
301 C NDIVW - NUMBER OF DIVIDING OF THE FIRST SIDE OF PARAL.
302 C NDIVH - NUMBER OF DIVIDING OF THE SECOND SIDE OF PARAL.
303 C RS(L),ZS(L) - CILINDER COORDINATES OF CENTERS OF CELLS OF DIVIDING
304 C L = 1,2,...,NDIVRE ! (IN METER)
305 C PS - CURRENT OF EVERY CELL OF DIVIDING (IN MA)
306 C VERS - VERTICAL (OR LINEAR, OR RADIUS) SIZE OF CELL CROSS-S.
307 C HORS - HORIZONTAL SIZE OF CELL CROSS-SECTION
308 C
309 C**************************************************************
310 C
311  SUBROUTINE divpar( RC, ZC, WC, HC, AWC, AHC, CURC, NDIV,
312  * ndivre, ndivw, ndivh, rs, zs, ps,
313  * vers, hors )
314 C
315 C
316  include 'double.inc'
317 C
318  dimension rs(1), zs(1)
319 C
320 C**************************************************************
321  sin(x) = dsin(x)
322  cos(x) = dcos(x)
323  atan(x) = datan(x)
324  sqrt(x) = dsqrt(x)
325 C**************************************************************
326 C
327  IF(ndiv.EQ.0) THEN
328  ndivw = 1
329  ndivh = 1
330  ndivre = 1
331  rs(1) = rc
332  zs(1) = zc
333  ps = curc
334  vers = hc
335  hors = wc
336  RETURN
337  END IF
338 C***************************************
339 C
340  IF(ahc.LT.0) ahc = ahc + 180.
341 C
342  IF(ndiv.GE.0) THEN
343  ndiva = ndiv
344  ELSE
345  ndiva = -ndiv
346  END IF
347 C***************************************
348 C PARAMETERS OF PARALLELOGRAM
349 C
350  xx = 1.
351  pi = 4.*atan(xx)
352 C
353  awcr = awc * pi /180.
354  ahcr = ahc * pi /180.
355 C
356  r0 = rc - 0.5*( wc + hc * cos(ahcr)/sin(ahcr) )
357  z0 = zc - 0.5*( hc + wc * sin(awcr)/cos(awcr) )
358 C
359  wsize = wc / cos(awcr)
360  hsize = hc / sin(ahcr)
361 C
362  wr = wc
363  wz = wc * sin(awcr) / cos(awcr)
364  hr = hc * cos(ahcr) / sin(ahcr)
365  hz = hc
366 C***************************************
367 C CALCULATION NDIVW, NDIVH, NDIVRE, PS
368 C
369  sw = sqrt( ndiva*wsize/hsize )
370  sh = sqrt( ndiva*hsize/wsize )
371  sw = sw + 0.5
372  sh = sh + 0.5
373 C
374  ndivw = idint(sw)
375  ndivh = idint(sh)
376 C
377  IF(ndivw.EQ.0) ndivw = 1
378  IF(ndivh.EQ.0) ndivh = 1
379 C
380  IF((ndiv.LT.0).AND.(ndivw.GT.ndiva)) ndivw = ndiva
381  IF((ndiv.LT.0).AND.(ndivh.GT.ndiva)) ndivh = ndiva
382 C
383  ndivre = ndivw * ndivh
384  ps = curc / ndivre
385 C***************************************
386 C CALCULATION RS(L), ZS(L) : L = 1,2,...,NDIVRE
387 C
388  wr = wr / ndivw
389  wz = wz / ndivw
390  hr = hr / ndivh
391  hz = hz / ndivh
392 C
393  hors = wr
394  vers = hz
395 C
396  rs(1) = r0 + 0.5*(wr + hr)
397  zs(1) = z0 + 0.5*(wz + hz)
398 C
399  DO 1 i=1,ndivw
400  DO 1 j=1,ndivh
401  l = (i-1)*ndivh + j
402  rs(l) = rs(1) + (i-1)*wr + (j-1)*hr
403  zs(l) = zs(1) + (i-1)*wz + (j-1)*hz
404  1 CONTINUE
405 C***************************************
406 C
407  RETURN
408  END
409 
410 
411 
412 
413 
414 
415 
subroutine trecur(NCPFC, RI, ZI, PC, NTYPE, NECON, WECON, HORS, VERS, NPRI, NTER)
Definition: Trecur_2.f:56
subroutine divpar(RC, ZC, WC, HC, AWC, AHC, CURC, NDIV, NDIVRE, NDIVW, NDIVH, RS, ZS, PS, VERS, HORS)
Definition: Trecur_2.f:311