Screamer Project  V3.3.1
Screamer Structure
 All Files Functions Variables
tblfunc.f
Go to the documentation of this file.
1  function ftabcond (time, cond, npts, pts, ltime)
2 c
3 c Define passed variables
4 c
5  integer npts, ltime
6  real time, cond, pts(npts)
7 c
8 c Define internal variables
9 c
10  real almost0, ralmost0
11  parameter(almost0 = 1.0e-12)
12  parameter(ralmost0 = 1.0 / almost0)
13 c
14 c Change log
15 c
16 c 2014-02-06 RBS: Changed real*4 to real
17 c
18 c Interpolates with a piecewise linear function using time as the independent
19 c variable. pts(i) i=1,4,7,... are the independent variable parameters (time)
20 c and pts(j) j=2,5,8,... are the dependent variable parameters f(time).
21 c Also, this checks against a function (piece-wise linear) fcond(time)
22 c residing in pts(k), k=3,6,9,... such that
23 c ftabcond = f(time) if cond .ge. fcond(time)
24 c = 0 if cond .lt. fcond(time)
25 c npts is at least 6 and is an even integer.
26 c pts(1) < pts(4) < pts(7) ... .
27 c ltime is an integer that points to the last independent variable in
28 c pts which the previous time was less than (speeds the lookup).
29 c (note that we are assuming that each time this is called for a particular
30 c circuit element section, the time has increased).
31 c Set ltime=0 if this is the first call.
32 c
33 c Find the endpoints for the independent variable.
34 c Set value to zero if outside of independent variable range given.
35 c
36  if ((time .lt. pts(1)) .or. (time .gt. pts(npts-2))) then
37  ftabcond = 0.0
38  ltime = 0
39  return
40  end if
41 c
42 c Use ltime to set the looping.
43 c And find the two time points which bracket the specified time.
44 c
45  if (ltime .lt. 4) then
46  i = 4
47  else
48  i = ltime
49  end if
50  time1 = pts(i-3)
51  time2 = pts(i)
52 c
53  do while ((time .lt. time1) .or. (time .gt. time2))
54  i = i + 3
55  time1 = time2
56  time2 = pts(i)
57  end do
58 c
59 c Find the conditional value to check against the specified cond
60 c First find the inverse table time difference,
61 c then the time increment from the first table time point.
62 c
63  tdiff = amax1((time2-time1), almost0)
64  tdiff = 1.0 / tdiff
65  tdel = time - time1
66 c
67  slope = (pts(i+2) - pts(i-1)) * tdiff
68  fcond = pts(i-1) + tdel*slope
69 c
70 c If satisfy condition, find f(time), else set it to zero.
71 c
72  if (cond .ge. fcond) then
73  slope = (pts(i+1) - pts(i-2)) * tdiff
74  ftabcond = pts(i-2) + tdel*slope
75  else
76  ftabcond = 0.0
77  end if
78 c
79  ltime = i
80 c
81  return
82  end
function ftabcond(time, cond, npts, pts, ltime)
Definition: tblfunc.f:1
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