C+ C NAME: C LOSIntegralV C PURPOSE: C Calculate model line of sight values for IPS velocities C CATEGORY: C Data processing C CALLING SEQUENCE: subroutine LOSIntegralV(I__VD,XCbegMAT,XCendMAT,V3D,G3D,PPlos,WWlos,VPlos,VMDL,VWT,VSUM,VVG2) C INPUTS: C I__VD integer TOM__V (IPS velocities) or TOM__G (g-levels) C XCbegMAT(nTim) real start Carrington variable C XCendMAT(nTim) real end Carrington variable C V3D(nLng,nLat,nRad,nTim)real velocities C G3D(nLng,nLat,nRad,nTim)real g^2 C PPlos(4,NLOS,NL) real Lng/lat/rad/time of points on los C WWlos(NLOS,NL) real integration weight for each los segment (from href=LOSWeights=) C VSUM ( NL) real scratch array C VVG2 (NLOS,NL,2) real scratch array C OUTPUTS: C VMDL(NL) real model IPS V values C VWT (NLOS,NL) real weights used in href=BuildSourceSurface= to combine C los segments projected into the same bin C CALLS: C T3D_iget, GetLOSValue, ArrR4TimesArrR4, ArrR4Total C ArrR4DivideByConstant, ArrR4DivideByArrR4 C INCLUDE: include 't3d_param.h' include 't3d_array.h' C PROCEDURE: C bInclV controls the calculation of VWT, the weights passed to BuildSourceSurface. C bInclV=.TRUE. : VWT = WWlos*g^2*Vperp/Integral(WWlos*g^2*Vperp) C bInclV=.FALSE.: VWT = WWlos*g^2/Integral(WWlos*g^2) C In both cases the sum of the weights along the line of sight is 1. C MODIFICATION HISTORY: C NOV-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- integer I__VD real XCbegMAT(*) real XCendMAT(*) real V3D (*) ! Velocities real G3D (*) ! g^2 real PPlos (*) ! Lng/lat/rad/time of points on los real WWlos (*) ! LOS weights from LOSWeights real VPlos (*) real VMDL (*) ! Model velocities for a given source real VWT (*) ! Modified weights passed to BuildSourceSurface real VSUM (*) ! Scratch array real VVG2 (*) ! Scratch array logical bInclV include 't3d_loc_fnc.h' call T3D_iget(T3D__MODE,0,MODE) if (I__VD .eq. TOM__V) call T3D_iget(T3D__NL_V,0,NL) if (I__VD .eq. TOM__G) call T3D_iget(T3D__NL_G,0,NL) call T3D_iget(T3D__NLOS_V,0,NLOS) bInclV = iand(MODE,TOM__INCLV) .ne. 0 NP = NLOS*NL ! Velocity and g^2 on all los segments call GetLOSValue(1,1,XCbegMAT,XCendMAT,V3D,NP,PPlos,VVG2 ) call GetLOSValue(1,1,XCbegMAT,XCendMAT,G3D,NP,PPlos,VVG2(NP+1)) call ArrR4TimesArrR4(NP,VVG2,VPlos,VVG2) ! Vperp call ArrR4TimesArrR4(NP,WWlos,VVG2(NP+1),VVG2(NP+1)) ! WWlos*g^2 call ArrR4TimesArrR4(NP,VVG2(NP+1),VVG2,VVG2) ! WWlos*g^2*Vperp do I=1,NL L = locLOS(1,I) VMDL(I) = ArrR4Total(NLOS,VVG2(L ),J) ! Sum(WWlos*g^2*Vperp) VSUM(I) = ArrR4Total(NLOS,VVG2(L+NP),J) ! Sum(WWlos*g^2) end do if (bInclV) then do I=1,NL ! WWlos*g^2*Vperp/Sum(WWlos*g^2*Vperp) L = locLOS(1,I) call ArrR4DivideByConstant(NLOS,VVG2(L),VMDL(I),VWT(L)) end do else do I=1,NL ! WWlos*g^2/Sum(WWlos*g^2) L = locLOS(1,I) call ArrR4DivideByConstant(NLOS,VVG2(L+NP),VSUM(I),VWT(L)) end do end if call ArrR4DivideByArrR4(NL,VMDL,VSUM,VMDL) ! Sum(WWlos*g^2*Vperp)/Sum(WWlos*g^2) return end