Screamer Project  V3.3.1
Screamer Structure
 All Files Functions Variables
abdiomdl.f
Go to the documentation of this file.
1  subroutine sabdiode_model
2 c Read-only arguments
3  & (vt2,
4 c Read and write arguments
5  & var_parms,
6 c Write-only arguments
7  & conductance)
8 c
9 c ----------------------------------------------------------------------------
10 c
11 c December 10, 1992; hnw
12 c
13 c Applied-B Diode model of M.P.DesJarlais.
14 c
15 c 'vt2' is the voltage across the diode at the last full time step (t=i-1).
16 c
17 c 'conductance' is the returned value of the diode conductance at
18 c t=i-1/2.
19 c The maximum growth rate of the conductance is never allowed to exceed
20 c ratemax.
21 c The derivative of the conductance is never allowed to change
22 c sign in one time step. If the calculated value of the conductance would
23 c entail a sign change, then the conductance is set to the value at the
24 c last time step.
25 c
26 c This model sets conductance to an open circuit value for negative voltage.
27 c
28 c ----------------------------------------------------------------------------
29 c
30 c Declare passed arguments
31 c
32  real vt2
33  real var_parms(*)
34  real conductance
35 c
36 c Declare internal parameters
37 c
38  real pi
39  parameter(pi = 3.14159)
40  real enhancemin
41  parameter(enhancemin = 9.0 * pi * pi / 16.0)
42  real s0
43  parameter(s0 = 1.6806)
44  real nu
45  parameter(nu = 0.6416)
46  real mu
47  parameter(mu = 0.2982)
48  real condvneg
49  parameter(condvneg = 1.0e-6)
50  real smallv
51  parameter(smallv = 0.01) !small voltage relative to vstar
52  real nearly1
53  parameter(nearly1 = 0.99) !voltage near, relatively, to vstar
54 c
55 c Declare internal variables
56 c
57  real gap !diode gap
58  real mconst !calculational constant
59  real sconst !calculational constant
60  real iclconst !calculational constant
61  real vt3 !voltage at t=i-3/2
62  real vt4 !voltage at t=i-2
63  real gt5 !conductance at t=i-3/2 (from last time step)
64  real x0 !distance from cathode corner to gas cell foil
65  real gmax !max. conductance
66  real gmin !min. conductance
67  real vstar !voltage at which current diverges
68  real ionfrac !ion current fraction of the total beam current
69  real derivt4 !the value of gt3-gt5
70  real derivt6 !the value of gt5-gt7
71  real ratemax !the max growth rate
72  real enhance
73  real s
74  real gs
75  real rate
76 c
77 c Set model parameters to understandable names.
78 c
79  gap = var_parms(1)
80  mconst = var_parms(2)
81  sconst = var_parms(3)
82  iclconst = var_parms(4)
83  vt4 = var_parms(5)
84  gt5 = var_parms(6)
85  x0 = var_parms(7)
86  gmax = var_parms(8)
87  gmin = var_parms(9)
88  vstar = var_parms(10)
89  ionfrac = var_parms(11)
90  derivt6 = var_parms(12)
91  ratemax = var_parms(13)
92 c
93 c ----------------------------------------------------------------------------
94 c
95 c Set vt3 to average of vt2 and vt4. Use this to calculate conductance.
96 c Note that this is one time step behind.
97 c
98  vt3 = 0.5*(vt2+vt4)
99 c
100 c If the voltage is negative, set the conductance for an open circuit
101 c (so it really is a diode).
102 c
103  if (vt3 .lt. 0.0) then
104  conductance = condvneg
105 c
106 c If the voltage is nonnegative and less than vstar*smallv, set the
107 c enhancement factor to enhancemin, then calculate conductance.
108 c
109  else if (vt3 .lt. vstar*smallv) then
110  enhance = enhancemin
111  conductance = enhance * iclconst * sqrt(vt3) / ionfrac
112  if (conductance .lt. gmin) then
113  conductance = gmin
114  else if (conductance .gt. gmax) then
115  conductance = gmax
116  end if
117 c
118 c Otherwise calculate the enhancement factor normally, then calculate
119 c conductance.
120 c
121  else
122  s = sconst / vt3
123  gs = (abs(s-s0))**nu
124  gs = exp(gs)
125  gs = (gs - 1.0) / (gs - mu)
126  enhance = (x0 + gs*gap) / gs
127  enhance = mconst * enhance * enhance
128  conductance = enhance * iclconst * sqrt(vt3) / ionfrac
129 c
130 c .. Now limit the growth rate if necessary.
131 c
132  rate = (conductance - gt5) / abs(0.5*(conductance + gt5))
133  if (abs(rate) .gt. ratemax) then
134  conductance = gt5 * (1.0 + ratemax) * sign(1.0,rate)
135  end if
136  write (88,*) 'growth-rate: ', rate
137 c
138 c .. Check against absolute limits
139 c
140  if (conductance .lt. gmin) then
141  conductance = gmin
142  else if (conductance .gt. gmax) then
143  conductance = gmax
144  end if
145 c
146  end if
147 c
148 c Now test the derivative of the conductance to see if it changed sign
149 c from the last time step. If it did set it to the conductance at the
150 c last time step and set the derivative to zero.
151 c
152  derivt4 = conductance - gt5
153  if (derivt6 .ne. 0.0) then
154  if (derivt4*derivt6 .lt. 0.0) then
155  conductance = gt5
156  derivt4 = 0.0
157  end if
158  end if
159  write (88,*) 'gt3,gt5,dgt4: ',
160  & conductance, gt5, derivt4
161 c
162 c Reset any model parameters needed for the next time-step iteration.
163 c
164  var_parms(5) = vt2
165  var_parms(6) = conductance
166  var_parms(12) = derivt4
167 c
168 c -----------------------------------------------------------------------------
169 c
170  return
171  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 c153 c c c Sin c c c remaining calls in rdscrelem c Tabular a10 Cond c c c &used with this model c Exponential model of a resistive c c c Rise model of a resistive c c Z FLOW POS c c c c SW1 c c c158 MFI Insulator CB c c & gmax
Definition: zdemfmt.h:154
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 gap
Definition: zdemfmt.h:84
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 c153 c c c Sin c c c remaining calls in rdscrelem c Tabular a10 Cond c c c &used with this model c Exponential model of a resistive c c c Rise model of a resistive c c Z FLOW POS c c c c SW1 c c c158 MFI Insulator CB c & gmin
Definition: zdemfmt.h:153
subroutine sabdiode_model
Definition: abdiomdl.f:1