Example #1
0
local real gdisk(real rad)
{
    real x;

    x = 0.5 * alpha * rad;
    return - alpha*alpha * mdisk * x *
	      (bessi0(x) * bessk0(x) - bessi1(x) * bessk1(x));
}
Example #2
0
static double plazmaWidth_integrand(double Pcm)
{ int err;
  double E1,E2,sqrt_s; 
  if(Pcm==0) return 0;  
  E1=sqrt(Pcm*Pcm+plazmaWidth_m[0]*plazmaWidth_m[0]);
  E2=sqrt(Pcm*Pcm+plazmaWidth_m[1]*plazmaWidth_m[1]);
  sqrt_s=E1+E2;
  if(sqrt_s<=plazmaWidth_m[2]+plazmaWidth_m[3]) return 0;
  
  return 4*bessk1(sqrt_s/plazmaWidth_T)*cs22(plazmaWidth_cc,1,Pcm, -1., 1. , &err)*pow(sqrt_s*Pcm,3.)/E1/E2; 
}
Example #3
0
void potential_double(int *ndim,double *pos,double *acc,double *pot,double *time)
{
    double apar, qpar, spar, ppar, lpar, rpar, rcyl;
    int i;

// 20070312 bwillett added ppar - the plummer denominator: r + rc = sqrt(x^2+y^2+z^2) + rc
// 20070312 bwillett added lpar - the logarithmic argument: R^2 + (z/q)^2 + d^2
// 20070427 bwillett added rpar - the spherical radius: r + rc - rc = ppar - plu_rc
// 20070501 bwillett added apar - a + qpar
// 20070507 bwillett took out pow statements
// 20070507 bwillett used hypot from math.h

    rcyl = hypot(pos[X],pos[Y]);
    ppar = sqrt ((pos[X]*pos[X])+(pos[Y]*pos[Y])+(pos[Z]*pos[Z])) + plu_rc;
    rpar = ppar - plu_rc;
    lpar = (rcyl*rcyl) + ((pos[Z]/q)*(pos[Z]/q)) + (d*d);

// This is only valid for 3 dimensions, and is in (x,y,z)
// Recall F_mu = -grad_mu U
// So a_mu = -grad_mu Phi
// I did these derivatives in Mathematica, and will try to keep it consistent with the conventions written above

	acc[X] = - ( ( (2.0*vhalo*vhalo*pos[X])/(lpar) ) + ( (plu_mass*pos[X])/(rpar*ppar*ppar) ) );
	acc[Y] = - ( ( (2.0*vhalo*vhalo*pos[Y])/(lpar) ) + ( (plu_mass*pos[Y])/(rpar*ppar*ppar) ) );
	acc[Z] = - ( ( (2.0*vhalo*vhalo*pos[Z])/(lpar) ) + ( (plu_mass*pos[Z])/(rpar*ppar*ppar) ) );

// Copied from expdisk.c
    double r2, r, arg, i0, k0, i1, k1, f;

	double alpha;
	alpha = 1.0/a;
	r = rpar;
	r2 = r*r;
    arg = 0.5*alpha*r;

	//printf("%f %f %f %f %f\n", a, mass, r, r2, x);
        i0=bessi0(arg);
        k0=bessk0(arg);
        i1=bessi1(arg);
        k1=bessk1(arg);

	// 20080928 - willeb added exponential disk to acceleration field 
        *pot = -mass*arg*(i0*k1-i1*k0);
        f = -0.5*alpha*alpha*alpha*mass*(i0*k0-i1*k1);
        acc[X] += f*pos[X];
        acc[Y] += f*pos[Y];
        acc[Z] += f*pos[Z];

// 20080928 - willeb added bulge and halo to potential 
    *pot += (-(plu_mass)/ppar);
*pot += (vhalo*vhalo*log(lpar));
}
Example #4
0
float bessk(int n, float x)
{
	float bessk0(float x);
	float bessk1(float x);
	void nrerror(char error_text[]);
	int j;
	float bk,bkm,bkp,tox;

	if (n < 2) nrerror("Index n less than 2 in bessk");
	tox=2.0/x;
	bkm=bessk0(x);
	bk=bessk1(x);
	for (j=1;j<n;j++) {
		bkp=bkm+j*tox*bk;
		bkm=bk;
		bk=bkp;
	}
	return bk;
}