From 6c17e4c1b03e1a0fa6c367d61db7fa41b3f55a80 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Tue, 29 Sep 2009 16:47:21 -0500 Subject: [PATCH] Support for hubble constant --- src/loadRamses.cpp | 11 ++++++++++- src/load_data.hpp | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/loadRamses.cpp b/src/loadRamses.cpp index 84d2b82..0eed042 100644 --- a/src/loadRamses.cpp +++ b/src/loadRamses.cpp @@ -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 diff --git a/src/load_data.hpp b/src/load_data.hpp index be2f088..a153815 100644 --- a/src/load_data.hpp +++ b/src/load_data.hpp @@ -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;