|
CLUMPY
Version 2011.09_corr2
|
| void rho_mix | ( | double & | r, |
| double | par[21], | ||
| double & | res | ||
| ) |
Definition at line 241 of file profiles.cc.
{
//--- Sets res = Density profile [Msol/kpc^3]
// Input:
// r Distance from the centre of the profile [kpc]
// par[0] rho_1(r) normalisation: density [Msol/kpc^3] or proxy for dPdV [kpc^{-3}]
// par[1] rho_1(r) scale radius [kpc]
// par[2] rho_1(r) shape parameter #1
// par[3] rho_1(r) shape parameter #2
// par[4] rho_1(r) shape parameter #3
// par[5] rho_1(r) card_profile [gENUM_PROFILE]
// par[6] UNUSED
// par[7] UNUSED
// par[8] UNUSED
// par[9] UNUSED
// par[10] switch_rho - selects which combination of rho_1 and rho_2 to use
// 0 -> rho(r) = rho1(r)
// 1 -> rho(r) = rho1(r)-rho2(r)
// 2 -> rho(r) = rho1(r)*rho2(r)
// par[11] rho_2(r) normalisation: density [Msol/kpc^3] or proxy for dPdV [kpc^{-3}]
// par[12] rho_2(r) scale radius [kpc]
// par[13] rho_2(r) shape parameter #1
// par[14] rho_2(r) shape parameter #2
// par[15] rho_2(r) shape parameter #3
// par[16] rho_2(r) card_profile [gENUM_PROFILE]
// par[17] UNUSED
// par[18] UNUSED
// par[19] UNUSED
// par[20] UNUSED
// Output:
// res Value of rho(r)
int switch_rho = (int)par[10];
int profile1 = (int)par[5];
// Calculate rho1(r)
switch (profile1) {
case kEINASTO:
res = rho_EINASTO(r, par);
break;
case kEINASTO_N:
res = rho_EINASTO_N(r, par);
break;
case kZHAO:
res = rho_ZHAO(r, par);
break;
default :
cout << ">>> rho_1: card_profile " << par[5]
<< " does not correspond to any profile => abort() " << endl;
abort();
}
// Check combi and calculate rho2 if necessary
if (switch_rho == 0) {
if (res > gDM_RHOSAT)
res = gDM_RHOSAT;
return;
} else {
int profile2 = (int)par[16];
double rho_2 = 0.;
switch (profile2) {
case kEINASTO:
rho_2 = rho_EINASTO(r, &par[11]);
break;
case kEINASTO_N:
rho_2 = rho_EINASTO_N(r, &par[11]);
break;
case kZHAO:
rho_2 = rho_ZHAO(r, &par[11]);
break;
default :
cout << ">>> rho_2: card_profile " << par[16]
<< " does not correspond to any profile => abort() " << endl;
abort();
}
if (switch_rho == 1) {
if (rho_2 < gDM_RHOSAT)
res -= rho_2;
return;
} else if (switch_rho == 2) {
res *= rho_2;
return;
} else {
cout << ">>> switch_rho: " << par[1]
<< " does not correspond to any combi for rho_1 and rho_2 => abort() " << endl;
abort();
}
}
return;
}