distcosmos.h

Go to the documentation of this file.
00001 #ifndef dist_cosmos_H
00002 #define dist_cosmos_H
00003 
00004 #include <cmath>
00005 #include <iostream>
00006 
00007 #include "basecosmos.h"
00008 
00009 #include "spline.h"
00010 #include "anchor.h"
00011 #include "miscmath.h"
00012 
00037 class distCosmos : public baseCosmos {
00038 protected:
00039   static const double flattol; 
00040   static const int ndist; 
00041   double zmax; 
00042 
00043   double h_h; 
00044 
00045   double Omega_m; 
00046   double Omega_v; 
00047   double Omega_rel; 
00048   double Omega_k; 
00049 
00050   Miscmath::keyword odetype; 
00051 
00052   Anchor SplineAnchor; 
00053   Spline* distSpline; 
00054   Spline* dDdzSpline; 
00055   Spline* Z2iHSpline; 
00056 
00057   virtual bool calc_isrebounding(); 
00058 
00059   void iEode(double, const double*, double*) const; 
00060 
00061 public :
00062   
00063   distCosmos(); 
00064   virtual ~distCosmos() {};
00065 
00066   void reset(); 
00067   virtual void initSplines(); 
00068 
00069   //Scale factor stuff
00070   double a_0() const {return 1.0;}  
00071   
00072   //Hubble constant stuff
00073   double h() const { return h_h; } 
00074   double h2() const { return h_h * h_h; } 
00075 
00076   virtual double E(double z) const; 
00077 
00078   double ZMax() const { return zmax; } 
00079 
00080   //Omegas
00081   double omega_m() { return Omega_m; } 
00082   double omega_v() { return Omega_v; } 
00083   double omega_relativistic() { return Omega_rel; } 
00084   virtual double omega_0() { return omega_m()+omega_v()+omega_relativistic(); } 
00085 
00086   //Current Densities
00087   double rho_0() const { return  M_p()*M_p()*h2()* 3.3379e-7;  } ; 
00088   double rho_m() { return rho_0() * omega_m(); } 
00089   double rho_relativistic() { return rho_0() * omega_relativistic(); } 
00090   double rho_v() { return rho_0() * omega_v(); } 
00091 
00092   //Initial Densities -- or, really, density at a
00093   double initialRho_m(const double a) { return rho_m()*pow(a/a_0(),-3); } 
00094   double initialRho_relativistic(const double a) { return rho_relativistic()*pow(a/a_0(),-4); } 
00095   double initialRho_v(const double a) { return rho_v(); } 
00096 
00097   double Z2iH(double z) { return Z2iHSpline->fastY(z); }  
00098 
00099   //Distances
00100   double propermotionDistance(double z) const;
00101   double angulardiameterDistance(double z) const;
00102   double luminosityDistance(double z) const;
00103   double luminosityDistance(double zhel, double zcmb) const;
00104   
00105   //Derivatives with distance
00106   double propermotionDistanceDeriv(double z) const;
00107   double angulardiameterDistanceDeriv(double z) const;
00108   double luminosityDistanceDeriv(double z) const;
00109 
00110   //Set various things
00111   void seth(double h) { h_h = h; setOmegaH2_rel( 2.471e-5 ); }
00112 
00113   void setOmega_m(double x) { Omega_m = x; Omega_k=1.0-omega_0();} 
00114   void setOmega_v(double x) { Omega_v = x; Omega_k=1.0-omega_0();} 
00115   void setOmega_relativistic(double x) { Omega_rel = x; Omega_k=1.0-omega_0(); } 
00116   void setOmegaH2_rel(double x) { Omega_rel = x / h2(); Omega_k=1.0-omega_0(); } 
00117 
00118   void setZMax(double x) { zmax = x; if (validHistory()) reset(); } 
00119 
00120   virtual void history(bool inform=false); 
00121 
00122 };
00123 
00124 #endif

Generated on Mon May 5 17:48:33 2008 for cmbeasy by  doxygen 1.4.6