Screamer Project  V3.3.1
Screamer Structure
 All Files Functions Variables
calcres.f
Go to the documentation of this file.
1  function calc_resistance (time, npts, pts, ltime)
2 c
3 c-------Description--------------------------------------------------
4 c
5 c Source File: calcres.f
6 c
7 c Author/Date: Kelley Fugelso, 1265 (SEA) 04/89
8 c
9 c 2014-02-06 RBS: Changed real*4 to real
10 c 2014-03-24 RBS: Made it explicit that we generate variable L as well
11 c
12 c Purpose: This subroutine determines the resistance (inductance) by
13 c interpolating using time as the indepdent variable.
14 c pts(i) i=1,3,5,... are the independent variable parameters
15 c and pts(i) i=2,4,6,... are the dependent variable parameters.
16 c ltime points to the last independent variable in pts which
17 c the previous time was less than (speeds up the lookup).
18 c
19 c Called by: Subroutine GET_TABLEM_VALUE
20 c
21 c Calls: none
22 c
23 c-------Input Parameters--------------------------------------------
24 c
25  integer npts, ! Number of points in array pts */
26  + ltime ! Pointer to last time used in lookup */
27  real time, ! Current problem time */
28  + pts(npts) ! Array of independent & dependent vals */
29 c
30 c-------Constants---------------------------------------------------
31 c
32  parameter(almost0 = 1.0e-12)
33  parameter(ralmost0 = 1.0 / almost0)
34 c
35 c-------Function Body-----------------------------------------------
36 c
37 c Find the endpoints for the independent variable.
38 c
39  if ((time .lt. pts(1)) .or. (time .gt. pts(npts-1))) then
40  calc_resistance = 0.0
41  ltime = 0
42  return
43  end if
44 c
45 c Use lasttime to set the looping.
46 c
47  if (ltime .lt. 3) then
48  i = 3
49  else
50  i = ltime
51  end if
52  time1 = pts(i-2)
53  time2 = pts(i)
54 c
55 c Set the index to the point in the table which brackets the current time.
56 c
57  do while ((time .lt. time1) .or. (time .gt. time2))
58  i = i + 2
59  time1 = time2
60  time2 = pts(i)
61  end do
62 c
63 c Set the time difference of the two table points and set the time incremented
64 c since the first table time point.
65 c Then interpolate to find the function.
66 c
67  tdiff = amax1((time2-time1), almost0)
68  tdel = time - time1
69  slope = (pts(i+1) - pts(i-1)) / tdiff
70  calc_resistance = pts(i-1) + tdel*slope
71 c
72  ltime = i
73 c
74 c-------Function End------------------------------------------------------
75 
76  return
77  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
function calc_resistance(time, npts, pts, ltime)
Definition: calcres.f:1