예제 #1
0
static double dY(double X, double Beps,double fast)
{ double d, dYdX,Yeq0X, sqrt_gStar, vSig,cFactor=sqrt(M_PI/45)*MPlank*Mcdm;
  double epsY;
  d=X*0.001; MassCut=Mcdm*(2-log(Beps)/X); dYdX=(Yeq(X+d)-Yeq(X-d))/(2*d);
  Yeq0X=Yeq(X);
  epsY=deltaY/Yeq0X;
  Yeq0X/=X;
  termod(Mcdm/X,&sqrt_gStar,NULL);
  vSig=vSigmaI(X,Beps, fast);
  if(vSig==0){ FError=1; return 0;}
  return -dYdX/(vSig*cFactor*sqrt_gStar*Yeq0X*Yeq0X)/sqrt(1+epsY*epsY);
} 
예제 #2
0
static double darkOmega1(double * Xf,double Z1,double dZ1,int Fast,double Beps)
{
  double X = *Xf;
  double CCX=(Z1-1)*(Z1+1);
  double dCCX=(Z1-1+dZ1)*(Z1+1+dZ1)-CCX;
  double ddY;
  double dCC1,dCC2,X1,X2;
    
  sigma= (Fast)?sigma_gauss:sigma_simpson;

  if(Beps>=1) Beps=0.999;
  vSigmaGrid.pow=0;
  
  ddY=dY(X,Beps,Fast); if(FError || ddY==0)  return -1;
  if(fabs(CCX-ddY)<dCCX) { *Xf=X; MassCut=Mcdm*(2-log(Beps)/X); return Yeq(X)*sqrt(1+ddY);} 
   
  dCC1=dCC2=ddY-CCX; ;X1=X2=X; 
  while(dCC2>0) 
  {  
     X1=X2;
     dCC1=dCC2;
     X2=X2/XSTEP;
     X=X2;
     dCC2=-CCX+dY(X,Beps,Fast);
  }
             
  while (dCC1<0)
  {  
     X2=X1;
     dCC2=dCC1;
     X1=X1*XSTEP;
     X=X1;
     dCC1=-CCX+dY(X,Beps,Fast); 
  }
  for(;;)
  { double dCC;
    if(fabs(dCC1)<dCCX) 
      {*Xf=X1; MassCut=Mcdm*(2-log(Beps)/X1); return Yeq(X1)*sqrt(1+CCX+dCC1);}
    if(fabs(dCC2)<dCCX || fabs(X1-X2)<0.0001*X1) 
      {*Xf=X2; MassCut=Mcdm*(2-log(Beps)/X2); return Yeq(X2)*sqrt(1+CCX+dCC2);}
    X=0.5*(X1+X2); 
    dCC=-CCX+dY(X,Beps,Fast);
    if(dCC>0) {dCC1=dCC;X1=X;}  else {dCC2=dCC;X2=X;} 
  }
}
예제 #3
0
static void XderivLn(double x, double *Y, double *dYdx)
{
  double y=Y[0];
  double yeq, sqrt_gStar;
  
  termod(Mcdm/x,&sqrt_gStar,NULL);
  MassCut=Mcdm*(2-log(Beps_)/x); yeq=Yeq(x);
  if(y<yeq) *dYdx=0; else 
  {
    double epsY=deltaY/y; 
    *dYdx=-(Mcdm/x/x)*MPlank*sqrt_gStar*sqrt(M_PI/45)*vSigmaI(x,Beps_,Fast_)*(y*y-yeq*yeq)*sqrt(1+epsY*epsY);
  }
}
예제 #4
0
double darkOmega(double * Xf, int Fast, double Beps)
{
  double Yt,Yi,Xt=25;
  double Z1=1.1;
  double Z2=10; 
  int i;
  double Xf1;

  if(Xf)*Xf=Xt;
  assignVal("Q",2*M);
  if(Beps>=1) Beps=0.999;
  if(Z1<=1) Z1=1.1;

  fast_=Fast;
  Yt=  darkOmega1(&Xt, Z1, (Z1-1)/5,Fast, Beps); 
  if(Yt<0||FError) return -1;
  Xf1=Xt;
  for(i=0; ;i++)
  { double X2=vSigmaGrid.xtop*pow(XSTEP,i+1);
    double y;

    if(Yt>=Z2*Yeq(Xt))  break;
    
    if(Xt>X2*0.999999) continue; 
    while(vSigmaGrid.pow<=i+1)
    { double X;
      if(vSigmaGrid.pow==vSigmaGrid.size)
      { vSigmaGrid.size+=10;
        vSigmaGrid.data=(double*)realloc(vSigmaGrid.data,sizeof(double)*vSigmaGrid.size);
      } 
     
      X=vSigmaGrid.xtop*pow(XSTEP,vSigmaGrid.pow);
      MassCut=M*(2-log(Beps)/X);      
      vSigmaGrid.data[vSigmaGrid.pow++]=aRate(X,0,Fast,NULL);
      if(FError) return -1;     
    }
    y=log(Yt);
    odeint(&y,1 , Xt , X2 , 1.E-3, (X2-Xt)/2, &XderivLn); 
    Yt=exp(y);
    Xt=X2;
  }
  if(Xf) *Xf=0.5*(Xf1+Xt);

  Yi=1/( (M/Xt)*sqrt(M_PI/45)*MPlank*aRate(Xt,1,Fast,NULL) );
  if(!finite(Yi)||FError)  return -1;

  return  2.742E8*M/(1/Yt  +  1/Yi); /* 2.828-old 2.755-new,2.742 -newnew */
}
예제 #5
0
double darkOmega(double * Xf, int Fast, double Beps)
{
  double Yt,Yi,Xt=25;
  double Z1=1.1;
  double Z2=10; 
  int i;
  double Xf1;
  
  if(Xf)*Xf=Xt;
  assignVal("Q",2*Mcdm);
  if(Beps>=1) Beps=0.999;
  Beps_=Beps; Fast_=Fast;
  
  if(Z1<=1) Z1=1.1;

  Yt=  darkOmega1(&Xt, Z1, (Z1-1)/5,Fast, Beps); 
  if(Yt<0||FError) {return -1;}
  Xf1=Xt;
  for(i=0; ;i++)
  { double X2=vSigmaGrid.xtop*pow(XSTEP,i+1);
    double y;

    if(Yt>=Z2*Yeq(Xt))  break;
    
    if(Xt>X2*0.999999) continue; 
    y=Yt;
    if(odeint(&y,1 , Xt , X2 , 1.E-3, (X2-Xt)/2, &XderivLn)){return -1;} 
    Yt=y;
    Xt=X2;
  }
  if(Xf) *Xf=0.5*(Xf1+Xt);
  Yi=1/( (Mcdm/Xt)*sqrt(M_PI/45)*MPlank*aRate(Xt,1,Fast,NULL,NULL));
  if(!finite(Yi)||FError)  return -1;
  if(deltaY==0.)
  { dmAsymm=0;
    return  2.742E8*Mcdm/(1/Yt  +  1/Yi); /* 2.828-old 2.755-new,2.742 -newnew */
  } else
  {  double a,f,z0,Y0;
     a=fabs(deltaY);
     f= (sqrt(Yt*Yt+a*a)-a)/
        (sqrt(Yt*Yt+a*a)+a)*exp(-2*a/Yi);
     z0=sqrt(f)*2*a/(1-f);
     Y0=sqrt(z0*z0+a*a);  
     dmAsymm=log((Y0+deltaY)/(Y0-deltaY));
     return 2.742E8*Mcdm*Y0;
  }   
}
예제 #6
0
static void XderivLn(double x, double *Y, double *dYdx)
{
  double y=exp(Y[0]);
  double yeq=Yeq(x);
  double sqrt_gStar;
  int i=log(x/vSigmaGrid.xtop)/log(XSTEP)-0.00001;
  double X1=vSigmaGrid.xtop*pow(XSTEP,i);   double sigmav1=vSigmaGrid.data[i];
  double X2=vSigmaGrid.xtop*pow(XSTEP,i+1); double sigmav2=vSigmaGrid.data[i+1];
  double sigmav;  
  
  sigmav1=log(sigmav1); sigmav2=log(sigmav2);

  if(i>0) 
  { double X0=vSigmaGrid.xtop*pow(XSTEP,i-1); double sigmav0=vSigmaGrid.data[i-1]; 

sigmav0=log(sigmav0);

    sigmav=sigmav0*(x-X1)*(x-X2)/(X0-X1)/(X0-X2)
          +sigmav1*(x-X0)*(x-X2)/(X1-X0)/(X1-X2)
          +sigmav2*(x-X0)*(x-X1)/(X2-X0)/(X2-X1); 
  }else if(i+2<vSigmaGrid.pow)
  { double X0=vSigmaGrid.xtop*pow(XSTEP,i+2); double sigmav0=vSigmaGrid.data[i+2];
sigmav0=log(sigmav0);
    sigmav=sigmav0*(x-X1)*(x-X2)/(X0-X1)/(X0-X2)
          +sigmav1*(x-X0)*(x-X2)/(X1-X0)/(X1-X2)
          +sigmav2*(x-X0)*(x-X1)/(X2-X0)/(X2-X1); 
    
  } else sigmav=(sigmav1*(x-X2)-sigmav2*(x-X1))/(X1-X2);

/*printf("sigmav=%e\n");*/
  
sigmav=exp(sigmav);
  
  termod(M/x,&sqrt_gStar,NULL);

  *dYdx=-(M/x/x)*MPlank*sqrt_gStar*sqrt(M_PI/45)*sigmav*(y-yeq*yeq/y);
  
/*printf("x=%e dydx=%e\n",x,*dYdx);*/

}
예제 #7
0
static double darkOmega1(double * Xf,double Z1,double dZ1,int Fast,double Beps)
{
  double X = *Xf;
  double sqrt_gStar;

  double CCX=(Z1-1)*(Z1+1);
  double dCCX=(Z1-1+dZ1)*(Z1+1+dZ1)-CCX;
  double d, dYdX,Yeq0X;
  double dCC,dCC1,dCC2,X1,X2,vSigma,vSigma1,vSigma2;
  double cFactor=sqrt(M_PI/45)*MPlank*M;
  int i;

  if(vSigmaGrid.data==NULL) 
  { vSigmaGrid.data=(double*)malloc(20*sizeof(double));
    vSigmaGrid.size=20; 
  }
    
  sigma= (Fast)?sigma_gauss:sigma_simpson;

  if(Beps>=1) Beps=0.999;

  MassCut=M*(2-log(Beps)/X);
  d=X*0.01; dYdX=(Yeq(X+d)-Yeq(X-d))/(2*d);
  Yeq0X=Yeq(X)/X;
  termod(M/X,&sqrt_gStar,NULL);
  vSigma=aRate(X,0,Fast,NULL); if(FError) return -1;
  if(vSigma ==0) 
  { printf("ERROR:Zero annihilation rate,\n");
    return -1;
  }

  dCC=-CCX-dYdX/(vSigma*cFactor*sqrt_gStar*Yeq0X*Yeq0X);


  vSigmaGrid.data[0]=vSigma;
  vSigmaGrid.xtop=X;
  vSigmaGrid.pow=1;  

  if(fabs(dCC)<dCCX) { *Xf=X; return Yeq(X)*sqrt(1+dCC+CCX);} 
   
  dCC1=dCC;dCC2=dCC;X1=X;X2=X; vSigma1=vSigma;vSigma2=vSigma;
  while(dCC2>0) 
  {  
     X1=X2;
     dCC1=dCC2;
     vSigma1=vSigma2;
     X2=X2/XSTEP;
     X=X2;
     MassCut=M*(2-log(Beps)/X);
     termod(M/X,&sqrt_gStar,NULL);
     d=0.01*X; dYdX= (Yeq(X+d)-Yeq(X-d))/(2*d);
     Yeq0X=Yeq(X)/X;
     vSigma2=aRate(X,0,Fast,NULL); if(FError) return -1;
     dCC2=-CCX-dYdX/(vSigma2*cFactor*sqrt_gStar*Yeq0X*Yeq0X);
     
     if(vSigmaGrid.pow==vSigmaGrid.size)
     { vSigmaGrid.size+=10;
       vSigmaGrid.data=(double*)realloc(vSigmaGrid.data,sizeof(double)*vSigmaGrid.size);
     }       
     for(i=vSigmaGrid.pow;i;i--) vSigmaGrid.data[i]=vSigmaGrid.data[i-1];
     vSigmaGrid.xtop=X; vSigmaGrid.data[0]=vSigma2; vSigmaGrid.pow++;
  }
             
  while (dCC1<0)
  {  
     X2=X1;
     dCC2=dCC1;
     vSigma2=vSigma1;
     X1=X1*XSTEP;
     X=X1;
     MassCut=M*(2-log(Beps)/X);
     termod(M/X,&sqrt_gStar,NULL);
     d=0.01*X; dYdX=(Yeq(X+d)-Yeq(X-d))/(2*d);
     Yeq0X=Yeq(X)/X;
     vSigma1=aRate(X,0,Fast,NULL); if(FError) return -1;
     dCC1=-CCX-dYdX/(vSigma1*cFactor*sqrt_gStar*Yeq0X*Yeq0X);

     if(vSigmaGrid.pow==vSigmaGrid.size)
     { vSigmaGrid.size+=10;
       vSigmaGrid.data=(double*)realloc(vSigmaGrid.data,sizeof(double)*vSigmaGrid.size);
     }       

     vSigmaGrid.data[vSigmaGrid.pow++]=vSigma1; 
  }
            
  for(;;) 
  { 
     if(fabs(dCC1)<dCCX)  { *Xf=X1; return Yeq(X1)*sqrt(1+dCC1+CCX);}
     if(fabs(dCC2)<dCCX)  { *Xf=X2; return Yeq(X2)*sqrt(1+dCC2+CCX);}
                
     X=(X1*dCC2 - X2*dCC1)/(dCC2-dCC1);
     MassCut=M*(2-log(Beps)/X);
     termod(M/X,&sqrt_gStar,NULL);
     d=0.01*X;  dYdX= (Yeq(X+d)-Yeq(X-d))/(2*d);
     Yeq0X=Yeq(X)/X;
     vSigma= (vSigma1*(X2-X) - vSigma2*(X1-X))/(X2-X1);
     dCC=-CCX-dYdX/(vSigma*cFactor*sqrt_gStar*Yeq0X*Yeq0X);
     if(dCC*dCC1>0) {dCC1=dCC;X1=X;vSigma1=vSigma;} else {dCC2=dCC;X2=X;vSigma2=vSigma;}
  }             

}