DeSitterConstantHeavisideGyratonNullTetrad( np.array([0, 0, r * np.exp(x * 1j), r * np.exp(-x * 1j)])) for x in np.linspace(0, 2 * np.pi * (N - 1) / N, num=N) ] initvels = [ DeSitterConstantHeavisideGyratonNullTetrad(-v0 / g(v0, v0, x0, lmb), True) for x0 in initpos ] wave = GeneralLambdaGyratonSolution(lmb, chi, _h, _hz, mu) static_plotter = StaticGeodesicPlotter(labels2d=["$U$", "$V$"]) dynamic_plotter = PlotlyDynamicPlotter(["x", "y", "U"], aspectratio=[1, 1, 1], showSpikes=False, bgcolor="#ccffeb", fontsize=30, ticks=True, tick_fontsize=15) dynamic_plotter2 = PlotlyDynamicPlotter(["x", "y", "V"], aspectratio=[1, 1, 1], showSpikes=False, bgcolor="#ccffeb", fontsize=30, ticks=True, tick_fontsize=15) dynamic_plotter3 = PlotlyDynamicPlotter(["x", "z", "t"], aspectratio=[1, 1, 1], showSpikes=False, bgcolor="#ccffeb", fontsize=30,
np.exp(-1j * phi)])) for phi in np.linspace(0, 2 * np.pi, num=NU) ] #u0 = [np.array([1, 1, 0, 0]) for phi in np.linspace(0, 2*np.pi * (N-1.) / N, num=N)] u0 = [np.array([1, 0, 0, 0]) for phi in np.linspace(-2, 2, num=NU)] initvels = [DeSitterNullTetrad(x, dif=True) for x in u0] #Can be generalized to different initial 4-vels wave = HottaTanakaSolution(lmb, mu) #Generate spacetime with wave ds = Solution() plotter = PlotlyDynamicPlotter(title=r"$\text{Hotta Tanaka solution, }\mu=" + str(mu) + ", \lambda=" + str(lmb) + "$", aspectratio=[1, 1, 1], labels=["Z4", "Z1", "Z0"], xrange=[-20, 20], yrange=[-20, 20], zrange=[-20, 20]) #Init 3D plotter # For each init pos generate geodesic (splitted) for x0, u0, geonum in zip(initpos, initvels, range(0, len(initpos))): a = wave.generate_geodesic(x0, u0, (-4, 2), max_step=0.1, christoffelParams=[lmb]) trajm, trajp = a[0] tm, tp = a[1] #trajp, tp = ds.generate_geodesic(x0, u0, (-20, 20), max_step=0.4, christoffelParams=[lmb]) color = "#{:06x}".format(random.randint(0, 0xFFFFFF)).upper()
lab = ["x", "y", "U"] convertFunction = toGyraUVxy plotName = "AS/ASMatterHearth" staticplotter = StaticGeodesicPlotter( labels2d=[r"$\mathcal{U}$", r"$\mathcal{V}$"], labelsize=16, aspect='auto', figsize=(6, 2.1)) for m, i in zip(mu, range(len(mu))): wave = AichelburgSexlSolution(m) plotter = PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=lab, xrange=[-6, 6], yrange=[-6, 6], zrange=[-1, 2], bgcolor="#ccffeb", fontsize=30) staticplotter2 = StaticGeodesicPlotter(labels2d=["x", "z"], labelsize=30, aspect='auto', figsize=(12, 6)) staticplotter2.ax.plot([0, 0], [-5, 5], "k-") for x0, u0, geonum in zip(initpos, initvels, range(0, len(initpos))): a = wave.generate_geodesic(x0, u0, (-1.3, 3), max_step=0.2,
mu = n / 2. sigma = mu / 2. return (gaussian((i + add) % n, mu, sigma), 0.1, (1.-gaussian((i + add) % n, mu, sigma))) N = 14 initu = np.array([1, 0, 0, 0]) initp = [DeSitterNullTetrad(np.array([0, x/np.pi - 1, 1.5+0j, 1.5+0j])) for x in np.linspace(0, 2 * np.pi, num=N) if np.abs(x) > 0.3] initv = [DeSitterNullTetrad(initu, dif=True) for x in np.linspace(0, 2 * np.pi, num=N) if np.abs(x) > 0.3] wave = HottaTanakaSolution(lmb, mu) statplotterUV = StaticGeodesicPlotter(labels2d=[r"$\mathcal{V}$", r"$\mathcal{U}$"], aspect="auto", ticks=True, tick_labelsize=14) statplotterxU = StaticGeodesicPlotter(labels2d=[r"$x$", r"$\mathcal{U}$"], aspect="auto", ticks=True, tick_labelsize=14) dynplotterxyU = PlotlyDynamicPlotter(labels=["x", "y", "U"], showSpikes=False, aspectratio=[1, 1, 1], bgcolor="#ccffeb", fontsize=30, ticks=True, tick_fontsize=15) dynplotterZ2Z3Z4 = PlotlyDynamicPlotter(labels=["Z2", "Z3", "Z4"], showSpikes=False, aspectratio=[1, 1, 1], bgcolor="#ccffeb", fontsize=30, ticks=True, tick_fontsize=15) dynplotterZ0Z2Z4 = PlotlyDynamicPlotter(labels=["Z4", "Z1", "Z0"], showSpikes=False, aspectratio=[1, 1, 1], bgcolor="#ccffeb", fontsize=30, ticks=True, tick_fontsize=15) for x0, u0, geonum in zip(initp, initv, range(0, len(initp))): #fr = -quadratic(geonum, (len(initp)-1)/2., 0.5/len(initp), 0.6) #to = quadratic(geonum, (len(initp)-1)/2., 0.7/len(initp), 1) fr, to = -1 - 1 / (geonum+1), 1 print("Integrating geo {} form {} to {}".format(geonum, fr, to)) print("Initial conditions are: x = {} ;u = {}".format(x0.x, u0.x)) a = wave.generate_geodesic(x0, u0, (fr, to), max_step=0.005, christoffelParams=[lmb], verbose=True) trajm, trajp = a[0] tm, tp = a[1] color = genRGB(geonum+0.5, len(initp)) #UV plot statplotterUV.plot(toConformalUVxy(trajm), xc=1, yc=0)
def H_z(x, arg): return -2 * arg[0] * (x[2]) plot = [2, 3, 1] lab = ["x", "y", "V"] convertFunction = toGyraUVxy plot2 = [2, 3, 0] lab2 = ["x", "y", "U"] convertFunction2 = toGyraUVxy plotName = "xsqr_ysqr/x_xsqr_ysqr_solution" plotter = PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=lab, xrange=[-10, 10], yrange=[-10, 10], zrange=[-4, 15], bgcolor="#ccffeb") plotter2 = PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=lab2, xrange=[-10, 10], yrange=[-10, 10], zrange=[-4, 15], bgcolor="#ccffeb") wave1 = GeneralMinkowskiRefractionSolution(H, H_z, .2) wave2 = GeneralGyratonicRefractionSolution(H, H_z, chi[0], .2) #Generate spacetime with wave plotterg = [] plotterg2 = [] for chival in chi: plotterg.append(PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=lab, xrange=[-10, 10], yrange=[-10, 10], zrange=[-4, 13], bgcolor="#ccffeb")) plotterg2.append(PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=lab2, xrange=[-10, 10], yrange=[-10, 10], zrange=[-4, 13], bgcolor="#ccffeb"))
from grimpulsivewaves.plotting import PlotlyDynamicPlotter import numpy as np rs = 1 def toCartNaive(x): return list(map(lambda x:[x[0], x[1] * np.sin(x[2]) * np.cos(x[3]), x[1] * np.sin(x[2]) * np.sin(x[3]), x[1] * np.cos(x[2])], x)) def metric(x, u, rs): return -(1-rs/x[1]) * u[0] * u[0] + 1/(1-rs/x[1]) * u[1] * u[1] + x[1]*x[1] * (u[2] * u[2] + np.sin(x[2])**2 * u[3] * u[3]) initpos = [SchwarzschildCoordinates(np.array([0, 3, np.pi/2, 0])), SchwarzschildCoordinates(np.array([0, 6, np.pi/2, 0])), SchwarzschildCoordinates(np.array([0, 0.95, np.pi/2, 0]))] initvel = [SchwarzschildCoordinates(np.array([1, 0, 0, 0]), dif=True), SchwarzschildCoordinates(np.array([1, 0, 0.052, 0]), dif=True), SchwarzschildCoordinates(np.array([0.1, 0.3, 0.5, 0]), dif=True)] gen = Solution() plotterRTphi = PlotlyDynamicPlotter(labels=["x", "z", "t"], aspectratio=[1, 1, 1], bgcolor="#ccffeb", fontsize=30) for x0, u0n, geonum in zip(initpos, initvel, range(len(initvel))): norm = metric(x0, u0n, rs) u0 = (u0n / norm) if norm < 0 else u0n print(norm) pos, t = gen.generate_geodesic(x0, u0, (0, 400), christoffelParams=[rs], max_step=0.1) plotterRTphi.plotTrajectory3D(toCartNaive(pos), t=t, xc=1, yc=3, zc=0, color="rgb(" + str(255 - geonum * 80) + "," + str(geonum * 80) + ",0)") plotterRTphi.export_html("schw.html")
# ACTUAL CODE HERE PROCEED WITH CAUTION (please) iposg = [DeSitterConstantHeavisideGyratonNullTetrad(x) for x in initpos] ivel0 = [DeSitterNullTetrad(x, True) for x in initvels] ivelg = [DeSitterConstantHeavisideGyratonNullTetrad(x, True) for x in initvels] waveGENG = GeneralLambdaGyratonSolution(lmb, chi, H1, H1Z) waveGEN0 = LambdaGeneralSolution(lmb, H1, H1Z) plotter0 = PlotlyDynamicPlotter(title=r"", aspectratio=[1, 1, 1], labels=lab, xrange=[-5, 5], yrange=[-5, 5], zrange=[-5, 5], showSpikes=True, bgcolor="#d1f1ff") plotterG = PlotlyDynamicPlotter(title=r"", aspectratio=[1, 1, 1], labels=lab, xrange=[-5, 5], yrange=[-5, 5], zrange=[-5, 5], showSpikes=True, bgcolor="#d1f1ff") if plotHyperboloids: plotter0.plotHyperboloid(-3. / 2., (-5, 5),
sigma = mu / 2. return [ gaussian((i + add) % n, mu, sigma) * 255., 0., (1. - gaussian((i + add) % n, mu, sigma)) * 255. ] plot = [2, 3, 0] lab = ["x", "y", "U"] convertFunction = toGyraUVxy plotName = "AS/ASRingGyraNull" plotter = PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=lab, xrange=[-10, 10], yrange=[-10, 10], zrange=[-4, 15], bgcolor="#ccffeb") plotterg = PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=lab, xrange=[-10, 10], yrange=[-10, 10], zrange=[-4, 13], bgcolor="#ccffeb") plotterg2 = PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=lab,
lmb = -1.0 initpos = [DeSitterNullTetrad(np.array([0, theta, 0j, 0j])) for theta in np.linspace(-.2, .2, num=N)] surps = [] #surpress #u0 = [np.array([1, 1, 0, 0]) for phi in np.linspace(0, 2*np.pi * (N-1.) / N, num=N)] u0 = [np.array([0.1, 0, 0, 0]) for theta in np.linspace(-2, 2, num=N)] initvels = [DeSitterNullTetrad(x, dif=True) for x in u0] #Can be generalized to different initial 4-vels wave = LambdaGeneralSolution(lmb, H, H_z) #Generate spacetime with wave plotter = PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=["Z4", "Z1", "Z0"], xrange=[-4.5, 4.5], yrange=[-4.5, 4.5], zrange=[-4.5, 4.5], showSpikes=True, bgcolor="#d1f1ff") #Init 3D plotter plotter.plotHyperboloid(lmb, (-2.5, 2.5), opacity=0.2, color="rgb(181,0,136)", drawImpulse=True, showlegend=True) plotter2 = PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=["Z4", "Z1", "Z0"], xrange=[-4.5, 4.5], yrange=[-4.5, 4.5], zrange=[-4.5, 4.8], showSpikes=True, bgcolor="#d1f1ff") #Init 3D plotter plotter2.plotCutAndPasteHyperboloid(1., lmb, (-2.5, 2.5), opacity=0.2, color="rgb(181,0,136)", drawImpulse=True, showlegend=True) # For each init pos generate geodesic (splitted) for x0, u0, geonum in zip(initpos, initvels, range(0, len(initpos))): a = wave.generate_geodesic(x0, u0, (-30, 30), max_step=0.1, christoffelParams=[lmb], rtol=1e-7, atol=1e-9) trajm, trajp = a[0]
sigma = mu / 2. return [gaussian((i + add) % n, mu, sigma) * 255., 0., (1.-gaussian((i + add) % n, mu, sigma)) * 255.] plot = [2, 3, 0] lab = ["x", "y", "U"] convertFunction = toGyraUVxy plotName = "Multipole/DipoleTimelike" for b1 in bu1: staticplotter = StaticGeodesicPlotter(labels2d=[r"$\mathcal{U}$", r"$\mathcal{V}$"], labelsize=16, aspect='auto', figsize=(6, 2.1)) for m, i in zip(mu, range(len(mu))): wave = GeneralMinkowskiRefractionSolution(H, H_z, m, b1) plotter = PlotlyDynamicPlotter(title="", aspectratio=[1, 1, 1], labels=lab, xrange=[-xran, xran], yrange=[-yran, yran], zrange=zran, bgcolor="#ccffeb", fontsize=30) staticplotter2 = StaticGeodesicPlotter(labels2d=["x", "z"], labelsize=30, aspect='auto', figsize=(12, 6)) staticplotter2.ax.plot([0, 0], [-5, 5], "k-") for x0, u0, geonum in zip(initpos, initvels, range(0, len(initpos))): a = wave.generate_geodesic(x0, u0, (-3, 6), max_step=0.2, verbose=False) trajm, trajp = a[0] tm, tp = a[1] rgb = genRGB(geonum, len(initpos), 8) rgb2 = genRGB(geonum, 2*len(initpos), len(initpos))