SUBROUTINE ROLL(jtb,v,den,wpar,angle,MODE,ICHN1,ICHN2,dcur) c modified for M mode jwb july 2 2019 common/rotmax/tcyssc(9),tscrtn(9),icoord,trot(9),voff(3), * tnossc(9),teclsc(9) common/spec/sblk(60) dimension nchn(2), dist(128) LOGICAL*4 LDIST integer*4 MODE,ICHN1,ICHN2 REAL V(3),vsc(3),vcup(3),vrsc(3) integer*2 jtb(6) DO 95 LKJ=1,128 95 DIST(LKJ)=0. conv = 3.141593/180. c write(6,146) jtb 146 format(6I5) call phase4(jtb,ieod) c c The following elements of common block spec and rotmax c are filled when we call phase4 (with some exceptions as noted below) c c SBLK(1): Distance from the Sun to S/C (AU) c 2 : Earth-Sun-S/C angle (degrees) c 3 : Inertial heliographic latitude of S/C (degrees) c 4 : Inertial heliographic longitude of S/C (degrees) c 5 : Inertial heliographic range of S/C (AU) same as SBLK(1) c 6 : Inertial heliographic latitude of Earth/IMP 8 (deg) c 7 : Inertial heliographic longitude of Earth/IMP 8 (deg) c 8 : Inertial heliographic range of Earth/IMP 8 (AU) c 9-12 : Normalized response of all cups to nominal solar wind c (SBLK(17)) with no modulator or suppressor voltage. c 13-16 : Component of the nominal solar wind velocity (SBLK(17)) c along each cup normal (km/s) c 17 : Nominal solar wind speed (if not available from mission c tape it is set to 400 km/s away from the Sun) c 19 : Distance of S/C from solar rotation axis (AU) c 20 : Distance of Earth from solar rotation axis (AU) c 21-23 : Unit vector from S/C to Sun, S/C coordinates c 24 : Distance of S/C from solar equatorial plane (AU) c 25 : Distance of Earth from solar equatorial plane (AU) c 26-29 : Angle between each cup normal and the sunward direction c (deg) c 40-42 : S/C velocity in Sun centered S/C coordinates (km/s) c 44-52 : Rotation matrix from S/C to RTN coordinates c c TCYSSC(1-9) : Rotation matrix from RTN to S/C coordinates c TSCRTN(1-9) : Rotation matrix from S/C to RTN coordinates c TNOSSC(1-9) : Rotation matrix from Interstelar to S/C coordinates c TECLSC(1-9) : Rotation matrix from ECL50 to S/C coordinates c c phase4 did not set voff, the negative of the s/c velocity in s/c c coordinates, we do it here by negating sblk(40-42) c CALL VSUM3 (voff,-1.,SBLK(40)) do 9928 m = 1,3 9928 voff(m) = -1.*SBLK(39+m) c phase4 did not set trot, the rotation matrix from RTN c to s/c coordinates, we do it here by taking the transpose of c the rotation matrix from s/c to RTN call teqatr(trot,tscrtn) c we now get aberrated speed in s/c cordinates from v in RTN c we do this by rotating our initial guess in RTN into s/c c coordinates and adding voff, which is equivalent to subtracting c the s/c velocity from our initial guess. CALL VTRNS(Vsc,trot,V,voff) c we now take the aberrated speed in s/c coordinates and rotate it c by an angle "angle" about the z axis of the s/c, mimicing a roll. vrsc(1) = vsc(1)*cos(angle*conv) +vsc(2)*sin(angle*conv) vrsc(2) = -vsc(1)*sin(angle*conv) +vsc(2)*cos(angle*conv) vrsc(3)=vsc(3) c we now take this rotated velocity in s/c coordinates and transform c it in to D cup coordinates, where the z-axis is along the normal to c the cup CALL VSCCP(Vrsc,4,VCUP) c now that we know the aberrated velocity in d cup coordinates we c call alan barnett's d cup routine to get the currents nchn(1) = 1 nchn(2) = 16 if(MODE .EQ. 1) GO TO 8954 nchn(2) = 128 8954 continue ldist = .false. call conrd call ldcur(den,wpar,vcup,1.,1.,MODE,nchn,ldist,dist) c we return to main only a sum of currents from ICHN1 to ICHN2, although c we calculate all of them if(ICHN2 .gt. ichn1) go to 8955 dcur = dist(ichn1) RETURN 8955 dcur = 0. do 8956 i = ichn1, ichn2 dcur = dcur + dist(i) 8956 continue return END