C+ C NAME: C LOSIntegralG C PURPOSE: C Calculate model line of sight g-levels C CATEGORY: C Data processing C CALLING SEQUENCE: subroutine LOSIntegralG(I__VD,XCbegMAT,XCendMAT,G3D,M2Mean,PPlos,WWlos,G2MDL,GWT,G2) C INPUTS: C I__VD integer TOM__V (IPS velocities) or TOM__G (g-levels) C XCbegMAT(nTim) real start Carrington variable (corresponding to I=nLng) C XCendMAT(nTim) real end Carrington variable (corresponding to I=1) C G3D(nLng,nLat,nRad,nTim)real g^2 C M2Mean(NL) real square of mean scintillation index (from LOSWeights) 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 G2 (NLOS,NL) real scratch array C OUTPUTS: C G2MDL(NL) real model G-levels C GWT (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 include 't3d_loc_fnc.h' C PROCEDURE: C Scintillation index m^2 = Int[W(z) dz] C Weighting function W(z) = (Delta N_e(z))^2 int dq sin^2(frac{q^2 lambda z}{4 pi}) C exp(-frac{theta_o^2 q^2 z^2}{2}) q^{-3} C C bInclG controls the calculation of GWT, the weights passed to BuildSourceSurface. C bInclG=.TRUE. : GWT = WWlos*g^2/Integral(WWlos*g^2) C bInclG=.FALSE.: GWT = WWlos /Integral(WWlos ) C In both cases the sum of the weights along a line of sight adds up to 1. C (Remember that M2Mean = Integral(WWlos)) C MODIFICATION HISTORY: C NOV-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- integer I__VD real XCbegMAT(*) real XCendMAT(*) real G3D (*) ! g^2 real M2Mean (*) ! Calculated in LOSWeights real PPlos (*) ! Lng/lat/rad/time of points on los real WWlos (*) ! Weights of each point along the los. real G2MDL (*) ! Model G-levels for a given source real GWT (*) ! Weights for BuildSourceSurface real G2 (*) ! Scratch array logical bInclG 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) bInclG = iand(MODE,TOM__INCLG) .ne. 0 I = NLOS*NL ! g^2 along los call GetLOSValue(1,1,XCbegMAT,XCendMAT,G3D,I,PPlos,G2) call ArrR4TimesArrR4(I,WWlos,G2,G2) ! WWlos*G2 do I=1,NL L = locLOS(1,I) G2MDL(I) = ArrR4Total(NLOS,G2(L),J) ! Sum(WWlos*G2) end do if (bInclG) then ! GWT = WWlos*G2/Sum(WWlos*G2) do I=1,NL L = locLOS(1,I) call ArrR4DivideByConstant(NLOS,G2(L),G2MDL(I),GWT(L)) end do else ! GWT = WWlos/Sum(WWlos) do I=1,NL L = locLOS(1,I) call ArrR4DivideByConstant(NLOS,WWlos(L),M2Mean(I),GWT(L)) end do end if call ArrR4DivideByArrR4(NL,G2MDL,M2Mean,G2MDL) ! G^2 = m^2/^2 return end