|
Program for the Article "The Direction of Pulses Emitted by a Relativistically Oscillating Charge Written by G.R.Dixon noxid100@cox.net Program for the Article "The Direction of Pulses Emitted by a Relativistically Oscillating Charge Written by G.R.Dixon noxid100@netzero.net Option Explicit Private Sub Command1_Click() '************* 'Compute the energy flux per quarter cycle vs. azimuth angle. '************* 'Physical and mathematical constants Const Steps As Double = 500 'Iterations (Azimuth) Const StepsP As Double = 500 / 4 'Iterations (Time) Const c As Double = 299792000# 'Speed of light Const epsilon0 As Double = 0.00000000000885 'Permittivity constant Const pi As Double = 3.14159265358979 Const vmax As Double = 0.9999 * c 'Maximum speed Const A As Double = 1 'Amplitude of oscillation Const omega As Double = vmax / A 'Angular frequency Const lambda As Double = 2 * pi * c / omega 'Wavelength Const R As Double = 10 * lambda 'Radius of surrounding surface Const tau As Double = 2 * pi / omega 'Period of oscillation Const deltat As Double = tau / (Steps) 'Time between epochs Const deltatheta As Double = pi / Steps 'Angle increment between surface rings Const q As Double = 1 'Particle charge
'Variables Dim i, j As Long 'Loop indexes Dim t(StepsP), theta(Steps) As Double 'Epochs and azimuth angles Dim tr As Double 'Retarded time Dim dt As Double 't - tr Dim dtmin As Double 'Minimum value for dt Dim dtmax As Double 'Maximum value for dt Dim xr As Double 'Retarded position Dim vr As Double 'Retarded velocity Dim ar As Double 'Retarded acceleration Dim Drx As Double 'x-component of vector Dr Dim Dry As Double 'y-component of vector Dr Dim Dr As Double 'Magnitude of vector Dr Dim ux As Double 'x-component of vector u Dim uy As Double 'y-component of vector u Dim Ex As Double 'x-component of electric field vector Dim Ey As Double 'y-component of electric field vector Dim Bz As Double 'z-component of magnetic field vector Dim Sx As Double 'x-component of Poynting vector Dim Sy As Double 'y-component of Poynting vector Dim dA As Double 'Area increment Dim dAx As Double 'x-component of area increment Dim dAy As Double 'y-component of area increment Dim Px As Double 'x-component of point on sphere Dim Py As Double 'y-component of point on sphere Dim Eflux(Steps) As Double 'Energy fluxes at angles theta, particular epoch Dim EfluxAzimuth(Steps) As Double 'Flux per quarter cycle at each theta
'Zero out the variable to be plotted vs. azimuth. For i = 0 To Steps - 1 EfluxAzimuth(i) = 0 Next i 'For each time epoch ... For j = 0 To StepsP - 1 Debug.Print j '********** 'Select the following instruction when the charge passes through 'the origin traveling in the positive x-direction. '********** t(j) = -tau / 8 + j * deltat
'********** 'Select the following instruction when the charge passes through 'the origin traveling in the negative x-direction. '********** 't(j) = 3 * tau / 8 + j * deltat
'...and for each azimuth angle ... For i = 0 To Steps - 1 '...compute the energy flux through the area between theta and theta+dtheta. theta(i) = i * deltatheta + deltatheta / 2 Px = R * Cos(theta(i)) 'Point on spherical surface Py = R * Sin(theta(i)) 'Ditto Dry = Py 'Dry is independent of retarded position dtmin = 0 dtmax = 5 * R / c Do dt = (dtmax + dtmin) / 2 tr = t(j) - dt xr = A * Sin(omega * tr) Drx = Px - xr 'Drx depends on retarded position Dr = Sqr(Drx ^ 2 + Dry ^ 2) If Abs(c * dt - Dr) < 2 ^ (-30) Then Exit Do If c * dt - Dr > 0 Then dtmax = dt Else dtmin = dt End If Loop vr = omega * A * Cos(omega * tr) ar = -(omega ^ 2) * A * Sin(omega * tr) ux = c * Drx / Dr - vr uy = c * Dry / Dr Ex = q / (4 * pi * epsilon0) * ((Dr / (Drx * ux + Dry * uy) ^ 3) * (ux * (c ^ 2 - vr ^ 2) - Dry * uy * ar)) Ey = q / (4 * pi * epsilon0) * ((Dr / (Drx * ux + Dry * uy) ^ 3) * (uy * (c ^ 2 - vr ^ 2) + Drx * uy * ar)) Bz = (1 / (Dr * c)) * (Drx * Ey - Dry * Ex) Sx = epsilon0 * c ^ 2 * Ey * Bz Sy = -epsilon0 * c ^ 2 * Ex * Bz dA = 2 * pi * R * Sin(theta(i)) * R * deltatheta dAx = dA * Cos(theta(i)) dAy = dA * Sin(theta(i)) Eflux(i) = (Sx * dAx + Sy * dAy) * deltat 'Update the running total energy flux per cycle at this angle. EfluxAzimuth(i) = EfluxAzimuth(i) + Eflux(i) Next i 'Repeat for the next time epoch. Next j 'Having computed the energy flux per quarter cycle as a function of azimuth, 'output the values for use by the plotting utility. Open "c:\WINMCAD\Physics\POSDirection.PRN" For Output As #1 For i = 0 To Steps - 1 Write #1, theta(i), EfluxAzimuth(i) Next i Close MsgBox ("Ready for plotting") Stop End Sub |