Screamer Project  V3.3.1
Screamer Structure
 All Files Functions Variables
nshelmdl.f
Go to the documentation of this file.
1  subroutine nshell_model
2 c read only arguments
3  & (time, dt, rdt, ilt2, vlt2,
4 c read and write arguments
5  & parms,
6 c write only arguments
7  & ldott2, lt1)
8 
9  character(len=80)::buffer
10 c ------------------------------------------------------------------------------
11 c June 6, 1997 Modified from the Cylindrical foil model by Ken Struve
12 c 2014-02-06 RBS: Changed real*4 to real
13 c
14 c Summary:
15 c
16 c This model adapted from the Cylindrical foil model. It will handle
17 c two collapsing shells, with no other mass acretion.
18 c This routine CANNOT be used with the cylindrical foil model since
19 c it uses the same output variable names.
20 c Treats r2 and l2 as variable elements (r2 is dl2/dt).
21 c
22 c Define:
23 c the next full time step as t=i (variable suffix t0)
24 c the current half time step as t=i-1/2 (variable suffix t1)
25 c the previous full time step as t=i-1 (variable suffix t2)
26 c the previous half time step as t=i-3/2 (variable suffix t3)
27 c the previous, previous full time step as t=i-2 (variable suffix t4)
28 c the previous, previous half time step as t=i-5/2 (variable suffix t5)
29 c
30 c Calculates the following values for an imploding shell:
31 c Passed via argument list:
32 c inductance (=lt1) at t=i-1/2
33 c time rate of change of inductance (=ldott2) at t=i-1
34 c Passed via 'zdemout.h' common blocks:
35 c foil kinetic energy (=foilke) at t=i-1/2
36 c foil radius (=foilrad) at t=i-1/2
37 c foil velocity (=foilvel) at t=i-1/2
38 c foil acceleration (=foilacc) at t=i-1
39 c When the calculated foil radius becomes less than or equal to the
40 c minimum radius, the implosion stops and this routine sets:
41 c radt1 = (foilrad =) minrad
42 c lt1 = mu * length * ln (initrad/minrad) (=lminrad)
43 c ldott2 = 0
44 c foilke = 0
45 c foilvel = 0
46 c foilacc = 0
47 c
48 c ------------------------------------------------------------------------------
49 c
50 c Include the file which has a common block for storing some unusual
51 c parameters from this model
52 c
53  include 'zdemmax.h' !parameters
54  include 'zdemout.h' !common blocks
55 c
56 c ------------------------------------------------------------------------------
57 c
58 c Read only passed arguments
59 c
60  real time !simulation time, t=i
61  real dt !time-step
62  real rdt !1/dt
63  real ilt2 !current through this inductor at t=i-1
64 c
65 c Read and write passed arguments
66 c
67  real parms(*) !model parameters for this circuit element
68 c
69 c Write only passed arguments
70 c
71  real ldott2 !time rate of change of inductance at t=i-1/2
72  real lt1 !inductance at t=i-1/2
73 c
74 c
75 c ------------------------------------------------------------------------------
76 c
77 c Set some internal parameters
78 c
79  real implode, end_implode
80  character*20 nameforit
81  logical debug
82  parameter(debug = .false.)
83  parameter(implode = 0.0, end_implode = 1.0)
84  parameter(deltar = 50.0e-6)
85 c
86 c Set internal variables
87 c
88  real newsvelocity(max_shells)
89  real lequiv, newlequiv !equivalent inductance of all shells
90  real wallrad !return current wall radius = akgap + initrad
91  real initrad !initial radius
92  real minrad !minimum radius
93  real mass !mass in kilograms
94  real reachedr2 !flag indicating whether second shell reached
95  real lconst !(mu*length)
96  real lminrad !inductance at minimum radius
97  real lt3 !inductance from t=i-3/2
98  real radt1 !calculated radius, t=i-1/2
99  real radt3 !radius from t=i-3/2
100  real velt1 !calculated velocity, t=i-1/2
101  real velt3 !velocity from t=i-3/2
102  real acct2 !calculated acceleration, t=i-1
103  real testimpl !calculated current state of foil
104  ! (imploding or stagnated)
105  real length !foil length in meters
106 c
107 c ------------------------------------------------------------------------------
108 c
109 c Set the model parameters to understandable names.
110 c
111  initrad = parms(1)
112  minrad = parms(2)
113  mass = parms(3)
114  length = parms(4)
115  lconst = parms(5)
116  lminrad = parms(6)
117  lt3 = parms(7)
118  radt3 = parms(8)
119  velt3 = parms(9)
120  testimpl = parms(10)
121  eload = parms(11)
122  peakcur = parms(12)
123  wallrad = parms(13)
124  lequiv = parms(14)
125  ttrap = parms(15)
126 c
127 c ------------------------------------------------------------------------------
128 c
129 c Calculate the acceleration, velocity and radius of the foil.
130 c From these, calculate L and dL/dt (=R)
131 c
132 c The acceleration at t=i-1 is defined by:
133 c acct2 = - ( mu * ilt2**2 *length) / (2 * mass * radt3)
134 c
135 c The time centered velocity is defined by:
136 c (velt1 - velt3) / dt = acct2
137 c
138 c The time centered radius is defined by:
139 c (radt1 - radt3) / dt = 0.5 * (velt1 + velt3)
140 c
141 c L (lt1) is defined by:
142 c (mu * length) * ln(initrad/radt1)
143 c
144 c dL/dt (ldott2) is defined by:
145 c (lt1 - lt3) / dt
146 c
147 c ------------------------------------------------------------------------------
148 c
149  if (abs(ilt2) .gt. peakcur) then
150  peakcur = abs(ilt2)
151  endif
152  eload = eload + ilt2*vlt2*dt
153 c For an imploding foil:
154 c
155  if (testimpl .eq. implode) then
156 c
157 c
158 c 0. Trap currents in inner shells when time of magnetic cutoff reached
159 c
160  factor = 1.0
161  if (time.gt.ttrap) then
162  factor = 0.0
163  if (.not.trapped) then
164  do i=1,numshells
165  rtrap(i)=shellradius(i)
166  itrap(i)=shellcurr(i)
167  end do
168  trapped=.true.
169  endif
170  endif
171 c
172 c a. Check if ith shell radius reached and adjust mass and velocity
173 c
174 c
175  do i=1,numshells
176  do j=i+1,numshells
177  if (((abs(shellradius(i)-shellradius(j)).lt.deltar).or.
178  & (shellradius(i).le.shellradius(j))).and.
179  1 (shell(j).eq.j)) then
180  shell(j)=i
181  mass=shellmass(i)+shellmass(j)
182  svelocity(i)=svelocity(i)*shellmass(i)/mass
183  shellmass(i)=mass
184  shellind(j)=1.0e30
185  shellradius(j)=shellradius(i)
186  shellmass(j)=0.0
187  shellcurr(j)=0.0
188  endif
189  end do
190  end do
191 c
192 c ------------------------------------------------------------------------------
193 c
194 c b. Calculate inductance, equivalent inductance, and currents in each shell
195 c
196  newlequiv=0.0
197  shellind(1)=lconst*log(wallrad/shellradius(1))
198  newlequiv=newlequiv+1.0/shellind(1)
199  do i=2,numshells
200  if (shell(i).eq.i) then
201  shellind(i)=lconst*log(wallrad/shellradius(i))
202  newlequiv=newlequiv+factor/shellind(i)
203  endif
204  end do
205  newlequiv=1.0/newlequiv
206 c
207 c
208 c Calculate currents before and after the first shell becomes
209 c magnetically opague and currents are trapped. Also skip
210 c current calculation for shells that have collided with another.
211 c
212 c
213  if (trapped) then
214  shellcurr(1)=ilt2
215  do i=2,numshells
216  if (shell(i).eq.i) then
217  shellcurr(i)=itrap(i)*log(rtrap(i-1)/rtrap(i))/
218  1 log(shellradius(i-1)/shellradius(i))
219  endif
220  end do
221  else
222  do i=1,numshells
223  if (shell(i).eq.i) then
224  shellcurr(i)=ilt2*newlequiv/shellind(i)
225  endif
226  end do
227  endif
228 c
229 c ------------------------------------------------------------------------------
230 c
231 c
232 c c. Foil acceleration
233 c
234  do i=1,numshells
235  if (shell(i).eq.i) then
236  acceleration(i)=lconst*(shellcurr(i+1)**2-shellcurr(i)**2)/
237  1 (2.0*shellmass(i)*shellradius(i))
238  endif
239  acceleration(i)=acceleration(shell(i))
240  end do
241 c
242 c ------------------------------------------------------------------------------
243 c
244 c
245 c d. Foil velocity
246 c
247  do i=1,numshells
248  newsvelocity(i)=svelocity(i)+acceleration(i)*dt
249  newsvelocity(i)=newsvelocity(shell(i))
250  end do
251 c
252 c ------------------------------------------------------------------------------
253 c
254 c e. Foil radius, check to see if less than minimum radius, if
255 c so, print a message that this has occurred and set values
256 c appropriately. But keep going with the calculation since
257 c the foil radius has changed this time step.
258 c
259  ekinetic=0.0
260  do i=1,numshells
261  shellradius(i)=shellradius(i)+(newsvelocity(i)+svelocity(i))*dt/2.
262  ekinetic=ekinetic+0.5*shellmass(i)*newsvelocity(i)**2
263  end do
264  do i=1,numshells
265  shellradius(i)=shellradius(shell(i))
266  enddo
267  if (shellradius(numshells) .lt. minrad) then
268  testimpl = end_implode
269  write(9,999) time, ekinetic, eload, peakcur,
270  & shellradius(1)
271 c 1 (shellradius(i),i=1,numshells)
272  write(9,998)
273 c write(6,999) time, Ekinetic, Eload, peakcur,
274  write(buffer,999) time, ekinetic, eload, peakcur,
275  & shellradius(1)
276 c 1 (shellradius(i),i=1,numshells)
277  call writebuffer(buffer)
278  write(buffer,998)
279  call writebuffer(buffer)
280 c write(6,998)
281  end if
282 c
283 c
284 c ------------------------------------------------------------------------------
285 c
286 c f. Foil inductance
287 c
288  lt1 = newlequiv
289 c
290 c
291 c ------------------------------------------------------------------------------
292 c
293 c g. Time rate of change of inductance
294 c
295  ldott2 = (newlequiv - lequiv) * rdt
296 c
297 c
298 c ------------------------------------------------------------------------------
299 c
300 c h. Put some values into a common block so that they will be
301 c available for plotting.
302 c
303  shellke = ekinetic
304  shellrad = shellradius(1)
305  shellvel = newsvelocity(1)
306  shellacc = acceleration(1)
307  shellm = shellmass(1)
308 c i. Save all values required for next time step.
309 c
310  do i=1,numshells
311  svelocity(i)=newsvelocity(i)
312  end do
313  parms(3) = shellmass(1)
314  parms(7) = lt1
315  parms(8) = radt1
316  parms(9) = velt1
317  parms(10) = testimpl
318  parms(11) = eload
319  parms(12) = peakcur
320  parms(14) = newlequiv
321 c
322 c
323 c For stagnant foil (constant radius and inductance):
324 c
325  else
326 c
327 c j. Foil inductance
328 c
329  lt1 = lequiv
330 c
331 c k. Time rate of change of inductance
332 c
333  ldott2 = 0.0
334 c
335 c l. Put some values into a common block so that they will be
336 c available for plotting.
337 c
338  shellke = 0.0
339  shellrad = minrad
340  shellvel = 0.0
341  shellacc = 0.0
342  shellm = shellmass(1)
343 c
344  end if
345 c
346 c ------------------------------------------------------------------------------
347 c
348  999 format
349  & (//
350  & ' ------------------------------------------------------------'/
351  & ' Foil radius has reached the minimum value.'/
352  & ' time: ', 1pe10.3/
353  & ' KE at implosion: ', 1pe10.3/
354  & ' load energy: ', 1pe10.3/
355  & ' peak current: ', 1pe10.3/
356  & ' outer shell radius: ', 1pe10.3)
357 c & ' shell radii: '/
358 c & 10(15x,1pe10.3))
359  998 format(/
360  & ' ------------------------------------------------------------'/
361  & //)
362 c
363 c ------------------------------------------------------------------------------
364 c
365  if (debug) then
366  write(9,*)'T = ',time,' L = ',newlequiv,' KE = ',ekinetic,
367  & ' Trapped Current = ',trapped
368  nameforit='Shell Number'
369  write(9,997)nameforit,(shell(i),i=1,numshells)
370  nameforit='Shell Radius'
371  write(9,996)nameforit,(shellradius(i),i=1,numshells)
372  nameforit='Shell Velocity'
373  write(9,996)nameforit,(svelocity(i),i=1,numshells)
374  nameforit='Shell Acceleration'
375  write(9,996)nameforit,(acceleration(i),i=1,numshells)
376  nameforit='Shell Mass'
377  write(9,996)nameforit,(shellmass(i),i=1,numshells)
378  nameforit='Shell Current'
379  write(9,996)nameforit,(shellcurr(i),i=1,numshells)
380  write(9,*)
381  endif
382  997 format(a20,13x,10(i2,12x))
383  996 format(a20,5x,10e14.4)
384  return
385  end
c *****************************************************************************c Various format statements for read_screamer_data output c To get these into made format to be characters c for each line corrected spelling errors in format added statement for Zflow Plasma Loss Model added format for CSV output type fixed more lines longer than characters added format for Measure Zflow Block and forward c reverse current directions in Zflow plasma loss c and Zflow POS models added format for SFC output type c removed from all code calls c c c c c a80 c i10 c No grids on plots c Do not write files containing the plotted points c Execute only one cycle c Do not echo the setup parameters and indicies c c &exitting c a13 c c c c c c c c102 c &described as a function of time c c c &described as a function of time c c c &function of time c c shell c &min A K c &trapped field time
Definition: zdemfmt.h:85
c *****************************************************************************c Various format statements for read_screamer_data output c To get these into made format to be characters c for each line corrected spelling errors in format added statement for Zflow Plasma Loss Model added format for CSV output type fixed more lines longer than characters added format for Measure Zflow Block and forward c reverse current directions in Zflow plasma loss c and Zflow POS models added format for SFC output type c removed from all code calls c c c c c a80 c i10 c No grids on plots c Do not write files containing the plotted points c Execute only one cycle c Do not echo the setup parameters and indicies c c &exitting c a13 c c c c c c c c102 c &described as a function of time c c c &described as a function of time c c c &function of time c c shell length
Definition: zdemfmt.h:83
subroutine nshell_model
Definition: nshelmdl.f:1