xzackli / Bolt.jl

differentiable boltzmann code
MIT License
43 stars 5 forks source link

Photon-baryon decoupling at very early times? #54

Closed marius311 closed 2 years ago

marius311 commented 3 years ago

This may just be basic thing I don't understand, but when I was making the movies for my COSMO talk, I noticed that baryons and photons actually decouple initially, then recouple. Is that right physically? I would have though at those early times theyre kept in extremely good equilibrium. Could that indicate an error in the code or the solver? Or maybe I set up the initial conditions wrong? (I changed \Phi initial per-mode, but everything else is consistent with that)

https://user-images.githubusercontent.com/1510968/128439630-d0093a7d-8862-4212-9aa1-704be1f1e824.mp4

My code is at https://github.com/xzackli/Bolt.jl/compare/main...marius311:cosmo21tweaks?expand=1 (not meant to be merged ever)

jmsull commented 3 years ago

I think they should be in very good equilibrium - so like you said the photon and baryon perturbations should overlap here, but they don't. I tried to reproduce Fig. 1 of Eisenstein Seo and White several weeks ago using CLASS, and when I run that code (which is similar to your procedure here, I think? To be honest I don't fully get the details of what you did =] ). I don't see any difference in photons and baryons at z=40,000 (attached, ignore the lazy FFT wiggles), so this is definitely not physical.

esw_z_40k

I am basically certain this is due to issue #52 I mentioned in the email - the older version of the code you are using has the wrong ICs. When I run your Pluto notebook (well almost your notebook, I am on 1.5 so PyPlot was breaking in Pluto, so I copied to a .jl file and animated in python separately) using my local version of Bolt with your modifications for \Phi_0 I don't see this issue ([poorly formatted] animation attached). I don't see exactly what you have in your animations (wiggles and divots, maybe the Phi set up should be different for the correct ICs), but the evolution is consistent between the photons and baryons. dtest

marius311 commented 3 years ago

Thanks for looking, ok thats super helpful to know. Yea I tried to backport the IC fix here in the code that I used, but perhaps I'm missing something else which is already fixed in later commits.

I would have used a more recent commit but main was broken for me when I started doing this, and I knew the old commit that I ended up using worked due to prior work, so I just went with it. Is there a more up-to-date branch that I can work from instead?

marius311 commented 3 years ago

To be honest I don't fully get the details of what you did =]

The evoluation equations only depend on the magnitude of the k-vector, not its complex phase (phase represents spatial translation, and that doesnt matter due to homogeity) and not its direction (due to isotropy). So basically I generated initial conditions by FFTing a 1D Gaussian. Then I evolve each k-mode using the equations, putting the IC to the amplitude of the k-mode, and sticking the phase back in at the end. Then I do an inverse FFT at the end to get the real-space picture back.

jmsull commented 3 years ago

Yeah sorry, that's on us. The fix for this is in the draft PR for the plin branch and not merged into main yet. I will try and put out a version of RSA that works soon and then it should be safe to work from the plin branch.

jmsull commented 3 years ago

Ok thanks a lot for explaining! The sticking the phase part back in was what I was missing.

jmsull commented 3 years ago

Will close this when plin is merged