double dark_density(double T, struct relicparam paramrelic) /* computes the dark energy density at temperature T */ { if((paramrelic.dd0==0.)||(T<paramrelic.Tdend)) return 0.; double rho_rad_1MeV=pi*pi/30.*geff(1.e-3,paramrelic)*1.e-12; return paramrelic.dd0*rho_rad_1MeV*pow(T/1.e-3,paramrelic.ndd); }
double CosmologyModel::dark_density(double T) /* computes the dark energy density at temperature T */ { if((dd0==0.)||(T<Tdend)) return 0.; double rho_rad_1MeV=pi*pi/30.*geff(1.e-3)*1.e-12; return dd0*rho_rad_1MeV*pow(T/1.e-3,ndd); }
static double weight_integrand(double v) { double x,gf; double sqrt_gStar; if(v==0.) return 0; x=xf_-3*log(v)/(y_pass-2); gf=geff(x); termod(M/x,&sqrt_gStar,NULL); return K1pol(1/(x*y_pass))*3*v*v*sqrt_gStar/(sqrt(x)*gf*gf*(y_pass-2)); }
double dark_entropy_Sigmad(double T, struct relicparam paramrelic) /* computes the dark entropy production at temperature T */ { if((paramrelic.sd0==0.)&&(paramrelic.Sigmad0==0.)) return 0.; if((paramrelic.Sigmad0==0.)&&(T<paramrelic.Tsend)) return 0.; double Mplanck=1.2209e19; if(paramrelic.Sigmad0==0.) { return 1./Mplanck*(sqrt(24.*pi*(pi*pi/30.*geff(T,paramrelic)*pow(T,4.)+dark_density(T,paramrelic)))*dark_entropy(T,paramrelic)-sqrt(4.*pi*pi*pi/45.)*heff(T,paramrelic)/sgStar(T,paramrelic)*pow(T,3)*sqrt(1.+dark_density(T,paramrelic)/(pi*pi/30.*geff(T,paramrelic)*pow(T,4.)))*dark_entropy_derivative(T,paramrelic)); } else { if(T<paramrelic.TSigmaend) return 0.; double s_rad_1MeV=2.*pi*pi/45.*heff(1.e-3,paramrelic)*1.e-9; double Sigma_rad_1MeV= 1./Mplanck*sqrt(4.*pi*pi*pi/5.*geff(1.e-3,paramrelic))*(1.e-6)*s_rad_1MeV; return paramrelic.Sigmad0*Sigma_rad_1MeV*pow(T/1.e-3,paramrelic.nSigmad); } }
double CosmologyModel::dark_entropy_Sigmad(double T) /* computes the dark entropy production at temperature T */ { if((sd0==0.)&&(Sigmad0==0.)) return 0.; if((Sigmad0==0.)&&(T<Tsend)) return 0.; double Mplanck=1.2209e19; if(Sigmad0==0.) { return 1./Mplanck*(sqrt(24.*pi*(pi*pi/30.*geff(T)*pow(T,4.)+dark_density(T)))*dark_entropy(T)-sqrt(4.*pi*pi*pi/45.)*heff(T)/sgStar(T)*pow(T,3)*sqrt(1.+dark_density(T)/(pi*pi/30.*geff(T)*pow(T,4.)))*dark_entropy_derivative(T)); } else { if(T<TSigmaend) return 0.; double s_rad_1MeV=2.*pi*pi/45.*heff(1.e-3)*1.e-9; double Sigma_rad_1MeV= 1./Mplanck*sqrt(4.*pi*pi*pi/5.*geff(1.e-3))*(1.e-6)*s_rad_1MeV; return Sigmad0*Sigma_rad_1MeV*pow(T/1.e-3,nSigmad); } }
double dark_entropy_derivative(double T, struct relicparam paramrelic) /* computes the dark energy entropy derivative at temperature T */ { if((paramrelic.sd0==0.)&&(paramrelic.Sigmad0==0.)) return 0.; if((paramrelic.Sigmad0==0.)&&(T<paramrelic.Tsend)) return 0.; if(paramrelic.Sigmad0==0.) { return (dark_entropy(T*1.001,paramrelic)-dark_entropy(T*0.999,paramrelic))/0.002/T; } else { double Mplanck=1.2209e19; return 3.*sgStar(T,paramrelic)/T/heff(T,paramrelic)*(sqrt(geff(T,paramrelic))*dark_entropy(T,paramrelic)-sqrt(5.*Mplanck/4./pi/pi/pi)/T/T*dark_entropy_Sigmad(T,paramrelic)/sqrt(1.+dark_density(T,paramrelic)/(pi*pi/30.*geff(T,paramrelic)*pow(T,4.)))); } }
double CosmologyModel::dark_entropy_derivative(double T) /* computes the dark energy entropy derivative at temperature T */ { if((sd0==0.)&&(Sigmad0==0.)) return 0.; if((Sigmad0==0.)&&(T<Tsend)) return 0.; if(Sigmad0==0.) { return (dark_entropy(T*1.001)-dark_entropy(T*0.999))/0.002/T; } else { double Mplanck=1.2209e19; return 3.*sgStar(T)/T/heff(T)*(sqrt(geff(T))*dark_entropy(T)-sqrt(5.*Mplanck/4./pi/pi/pi)/T/T*dark_entropy_Sigmad(T)/sqrt(1.+dark_density(T)/(pi*pi/30.*geff(T)*pow(T,4.)))); } }
double CosmologyModel::dark_entropy(double T) /* computes the dark entropy density at temperature T */ { if((sd0==0.)&&(Sigmad0==0.)) return 0.; if((Sigmad0==0.)&&(T<Tsend)) return 0.; if(Sigmad0==0.) { double s_rad_1MeV=2.*pi*pi/45.*heff(1.e-3)*1.e-9; return sd0*s_rad_1MeV*pow(T/1.e-3,nsd); } else { double lnT,dlnT,Ttmp; int ie,nmax; double integ=0.; nmax=50; lnT=log(1.e-15); dlnT=(log(T)-lnT)/nmax; for(ie=1;ie<nmax;ie++) { lnT+=dlnT; Ttmp=exp(lnT); integ+=sgStar(Ttmp)*dark_entropy_Sigmad(Ttmp)/sqrt(1.+dark_density(Ttmp)/(pi*pi/30.*geff(Ttmp)*pow(Ttmp,4.)))/pow(heff(Ttmp),2.)/pow(Ttmp,5.); } integ+=sgStar(T)*dark_entropy_Sigmad(T)/sqrt(1.+dark_density(T)/(pi*pi/30.*geff(T)*pow(T,4.)))/pow(heff(T),2.)/pow(T,5.)/2.; integ*=dlnT; double Mplanck=1.2209e19; return 3.*Mplanck*sqrt(5./4./pi/pi/pi)*heff(T)*T*T*T*integ; } }
static double Yeq(double X) { double heff; termod(M/X,NULL,&heff); return (45/(4*M_PI*M_PI*M_PI*M_PI))*X*X* geff(X)*sqrt(M_PI/(2*X))*exp(-X)/heff; }
static double aRate(double X, int everage,int Fast, float ** wPrc) { double Sum=0.; int i,l1,l2; int nPrc=0; char* pname[5]; gridStr grid,grid1; double MassCutOut=MassCut+M*log(100.)/X; double Msmall,Mlarge; int nPrcTot=0; if(MassCutOut<M*(2+10/X)) MassCutOut=M*(2+10/X); xf_=X; exi=everage; if(wPrc) *wPrc=NULL; for(l1=0;l1<NC;l1++) { int k1=sort[l1]; if(M+inMass[k1]>MassCut) break; for(l2=0;l2<NC;l2++) { double Sumkk=0.; double x[2],f[2]; double factor; int k2=sort[l2]; CalcHEP_interface * CI; if(inMass[k1]+inMass[k2] > MassCut) break; if(inC[k1*NC+k2]<=0) continue; if(code22[k1*NC+k2]==NULL) new_code(k1,k2); if(inC[k1*NC+k2]<=0) continue; if(!code22[k1*NC+k2]->init) { numout * cd=code22[k1*NC+k2]; CalcHEP_interface *cdi=cd->interface; for(i=1;i<=cdi->nvar;i++) if(cd->link[i]) cdi->va[i]=*(cd->link[i]); if( cdi->calcFunc()>0 ) {FError=1; return -1;} cd->init=1; } if(wPrc) { nPrcTot+=code22[k1*NC+k2]->interface->nprc; *wPrc=(float*)realloc(*wPrc,sizeof(float)*(nPrcTot)); } sqme=code22[k1*NC+k2]->interface->sqme; DeltaXf=(inDelta[k1]+inDelta[k2])*X; inBuff=0; M1=inMass[k1]; M2=inMass[k2]; Msmall=M1>M2? M1-M*(1-sWidth): M2-M*(1-sWidth); Mlarge=M1>M2? M2+M*(1-sWidth): M1+M*(1-sWidth); u_max=m2u(MassCutOut); if(Fast) { if(Fast==1) { double c[4]; for(Npow=0;Npow<4;Npow++) c[Npow]=simpson(s_pow_integrand, 0. ,1. ,1.E-4); gaussC2(c,x,f); for(i=0;i<2;i++){ x[i]=sqrt(x[i]); f[i]*=2*x[i]/M;} }else { double c[2]; for(Npow=0;Npow<2;Npow++) c[Npow]=simpson(s_pow_integrand, 0. ,1. ,1.E-4); x[0]= sqrt(c[1]/c[0]); f[0]= c[0]*2*x[0]/M; } } factor=inC[k1*NC+k2]*inG[k1]*inG[k2]*exp(-DeltaXf); CI=code22[k1*NC+k2]->interface; for(nsub=1; nsub<= CI->nprc;nsub++,nPrc++) { double u_min=0.; double a=0; if(wPrc) (*wPrc)[nPrc]=0; for(i=0;i<4;i++) pname[i]=CI->pinf(nsub,i+1,pmass+i,NULL); if(pmass[2]+pmass[3]>MassCutOut) continue; if( (pmass[2]>Mlarge && pmass[3]<Msmall) ||(pmass[3]>Mlarge && pmass[2]<Msmall)) { *(CI->twidth)=1; *(CI->gtwidth)=1;} else { *(CI->twidth)=0; *(CI->gtwidth)=0;} *(CI->gswidth)=0; if(pmass[2]+pmass[3] > pmass[0]+pmass[1]) { double smin=pmass[2]+pmass[3]; if((pmass[0]!=M1 || pmass[1]!=M2)&&(pmass[0]!=M2 || pmass[1]!=M1)) { double ms=pmass[0]+pmass[1]; double md=pmass[0]-pmass[1]; double Pcm=sqrt((smin-ms)*(smin+ms)*(smin-md)*(smin+md))/(2*smin); smin=sqrt(M1*M1+Pcm*Pcm)+sqrt(M2*M2+Pcm*Pcm); } u_min=m2u(smin); }else u_min=0; repeat: neg_cs_flag=0; if(!Fast) a=simpson(s_integrand,u_min,1.,eps); else if(Fast!=1) a=f[0]*sigma(x[0]); else { int isPole=0; char * s; int m,w,n; double mass,width; for(n=1;(s=code22[k1*NC+k2]->interface->den_info(nsub,n,&m,&w));n++) if(m && w && strcmp(s,"\1\2")==0 ) { mass=code22[k1*NC+k2]->interface->va[m]; width=code22[k1*NC+k2]->interface->va[w]; if(mass<MassCutOut && mass+8*width > pmass[0]+pmass[1] && mass+8*width > pmass[2]+pmass[3]) { if((pmass[0]!=M1 || pmass[1]!=M2)&&(pmass[0]!=M2 || pmass[1]!=M1)) { double ms=pmass[0]+pmass[1]; double md=pmass[0]-pmass[1]; double Pcm=sqrt((mass-ms)*(mass+ms)*(mass-md)*(mass+md))/(2*mass); mass=sqrt(M1*M1+Pcm*Pcm)+sqrt(M2*M2+Pcm*Pcm); } grid1=makeGrid(mass,width); if(isPole) grid=crossGrids(&grid,&grid1); else grid=grid1; isPole++; } } if(isPole==0) { grid.n=1; grid.ul[0]=u_min; grid.ur[0]=u_max; grid.pow[0]=3; } if(grid.n==1 && pmass[0]+pmass[1]> 1.1*(pmass[2]+pmass[3])) a=f[0]*sigma(x[0])+f[1]*sigma(x[1]); else for(i=0;i<grid.n;i++)if(u_min<=grid.ur[i]) { double ul= u_min<grid.ul[i]? grid.ul[i]:u_min; double da=gauss(s_integrand,ul,grid.ur[i],grid.pow[i]); a+=da; } } if(neg_cs_flag && *(CI->gswidth)==0) { *(CI->gswidth)=1; goto repeat; } /* printf("X=%.2E (%d) %.3E %s %s %s %s\n",X,everage, a, pname[0],pname[1],pname[2],pname[3]); */ Sumkk+=a; if(wPrc) (*wPrc)[nPrc] = a*factor; } Sum+=factor*Sumkk; /* printf("Sum=%E\n",Sum); */ } } if(wPrc) for(i=0; i<nPrc;i++) (*wPrc)[i]/=Sum; if(!everage) { double gf=geff(X); Sum/=gf*gf;} /* exit(1); */ return Sum; }