Author Topic: OmegaK and OmegaLambda in the template  (Read 83 times)

winther

  • Global Moderator
  • Member
  • Posts: 66
    • Website
OmegaK and OmegaLambda in the template
« on: 12. February 2021, 19:06:25 »
I discovered a thing that I should have improved in the template. As written now in the template one has to take in OmegaLambda and then set OmegaK by hand. What I should have done is the other way around - this makes more sense as we are always dealing with a flat Universe here (so one does not have to adjust the input to get a flat Universe). One can of course deal with this in the constructor by just setting OmegaK = 0  and then recomputing OmegaLambda = 1 - Sum Omega's, but one can also update the methods to make it logically consistent (which I will do for next year - have updated the GitHub now). If you want to update this in your code then what one can do is to just make a few changes to the methods:

In Main.cpp:
Code: [Select]
  // Background parameters
  double h           = 0.674;
  double OmegaB      = 0.05;
  double OmegaCDM    = 0.267;
  double OmegaK      = 0.0;       // XXX Change OmegaLambda->OmegaK
  double Neff        = 3.046;
  double TCMB        = 2.7255;

  // Recombination parameters
  double Yp          = 0.245;

  // Module I

  // Set up and solve the background
  BackgroundCosmology cosmo(h, OmegaB, OmegaCDM, OmegaK, Neff, TCMB);   // XXX Change OmegaLambda->OmegaK

In BackgroundCosmology.cpp:
Code: [Select]
BackgroundCosmology::BackgroundCosmology(
    double h,
    double OmegaB,
    double OmegaCDM,
    double OmegaK,      // XXX Change OmegaLambda->OmegaK
    double Neff,
    double TCMB) :
  h(h),
  OmegaB(OmegaB),
  OmegaCDM(OmegaCDM),
  OmegaK(OmegaK),   // XXX Change OmegaLambda->OmegaK
  Neff(Neff),
  TCMB(TCMB)
{
  ...
  ...

  // XXX Compute OmegaLambda
  OmegaLambda = 1 - OmegaK - OmegaB - OmegaCDM - OmegaR - OmegaNu;

}
« Last Edit: 12. February 2021, 19:19:02 by winther »

William

  • Member
  • Posts: 21
Re: OmegaK and OmegaLambda in the template
« Reply #1 on: 15. February 2021, 09:42:51 »
What should we set OmegaR to then? I ended up setting both OmegaK and OmegaLambda manually since the value of OmegaR wasn't mentioned in the Milestone overview, and then setting OmegaR = 1 - Sum Omega's.

William

  • Member
  • Posts: 21
Re: OmegaK and OmegaLambda in the template
« Reply #2 on: 15. February 2021, 09:50:24 »
Never mind! I forgot that we could calculate OmegaR from the CMB temperature :-)

winther

  • Global Moderator
  • Member
  • Posts: 66
    • Website
Re: OmegaK and OmegaLambda in the template
« Reply #3 on: 15. February 2021, 11:57:51 »
Ok great. Yes the photon energy density is just \( \rho_\gamma = g_\gamma\cdot \frac{1}{(2\pi)^3}\int d^3\vec{p} \frac{p}{e^{\frac{p}{T}}-1} =  2\cdot \frac{\pi^2}{30}\frac{(k_b T)^4}{\hbar^3c^5} \) which gives the expression for \( \Omega_\gamma\) (what we call OmegaR in the code template) that is given in the milestone-text: https://cmb.wintherscoming.no/milestone1.php#omegar