Support for hubble constant

This commit is contained in:
Guilhem Lavaux 2009-09-29 16:47:21 -05:00
parent b18f06b606
commit 6c17e4c1b0
2 changed files with 12 additions and 1 deletions

View File

@ -194,6 +194,7 @@ typedef struct
double unitLength;
double aexp;
double boxSize;
double hubble;
} InfoData;
int readInfoFile(const char *basename, int outputId, InfoData& info)
@ -249,6 +250,10 @@ int readInfoFile(const char *basename, int outputId, InfoData& info)
info.aexp = infoMap["aexp"];
info.boxSize = infoMap["boxlen"];
static const double CM_IN_MPC = 3.08e24;
double unit_t = infoMap["unit_t"];
info.hubble = info.aexp*info.aexp/unit_t / (1e5/CM_IN_MPC);
return 1;
}
@ -267,7 +272,10 @@ CosmoTool::PurePositionData *CosmoTool::loadRamsesPosition(const char *basename,
double L0 = info.boxSize*info.unitLength/CM_IN_MPC/info.aexp;
if (!quiet)
cout << "L0=" << L0 << " Mpc" << endl;
{
cout << "L0=" << L0 << " Mpc" << endl;
cout << "H=" << info.hubble << " km/s/Mpc" << endl;
}
if (!quiet)
cout << "Detecting number of files and particles..." << endl;
@ -320,6 +328,7 @@ CosmoTool::PurePositionData *CosmoTool::loadRamsesPosition(const char *basename,
assert(gd->pos != 0);
gd->NumPart = totPart;
gd->BoxSize = L0*1000;
gd->hubble = info.hubble;
if (!quiet)
cout << " Total number part=" << totPart << endl

View File

@ -60,11 +60,13 @@ namespace CosmoTool {
struct PurePositionData {
unsigned int NumPart;
double BoxSize;
double hubble;
FCoordinates *pos;
};
struct PhaseSpaceData {
unsigned int NumPart;
double hubble;
double BoxSize;
FCoordinates *pos;
FCoordinates *vel;