Commit b8b3e792 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added 1/a^3 as one of the commonly tracked variables.

parent 59da0571
...@@ -407,7 +407,7 @@ AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR(something is wrong with the math library!)) ...@@ -407,7 +407,7 @@ AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR(something is wrong with the math library!))
# Check for GSL # Check for GSL
have_gsl="no" have_gsl="no"
AC_CHECK_LIB([gslcblas],[cblas_dgemm]) AC_CHECK_LIB([gslcblas],[cblas_dgemm])
AC_CHECK_LIB([gsl],[gsl_blas_dgemm], have_gsl="yes") AC_CHECK_LIB([gsl],[gsl_integration_qag])
# Check for pthreads. # Check for pthreads.
AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
......
...@@ -120,6 +120,7 @@ void cosmology_update(struct cosmology *c, const struct engine *e) { ...@@ -120,6 +120,7 @@ void cosmology_update(struct cosmology *c, const struct engine *e) {
const double a_inv = 1. / a; const double a_inv = 1. / a;
c->a = a; c->a = a;
c->a_inv = a_inv; c->a_inv = a_inv;
c->a3_inv = a_inv * a_inv * a_inv;
/* Redshift */ /* Redshift */
c->z = a_inv - 1.; c->z = a_inv - 1.;
...@@ -146,7 +147,7 @@ void cosmology_update(struct cosmology *c, const struct engine *e) { ...@@ -146,7 +147,7 @@ void cosmology_update(struct cosmology *c, const struct engine *e) {
* @brief Computes \f$ dt / a^2 \f$ for the current cosmology. * @brief Computes \f$ dt / a^2 \f$ for the current cosmology.
* *
* @param a The scale-factor of interest. * @param a The scale-factor of interest.
* @param param The current #csomology. * @param param The current #cosmology.
*/ */
double drift_integrand(double a, void *param) { double drift_integrand(double a, void *param) {
...@@ -171,7 +172,7 @@ double drift_integrand(double a, void *param) { ...@@ -171,7 +172,7 @@ double drift_integrand(double a, void *param) {
* @brief Computes \f$ dt / a \f$ for the current cosmology. * @brief Computes \f$ dt / a \f$ for the current cosmology.
* *
* @param a The scale-factor of interest. * @param a The scale-factor of interest.
* @param param The current #csomology. * @param param The current #cosmology.
*/ */
double gravity_kick_integrand(double a, void *param) { double gravity_kick_integrand(double a, void *param) {
...@@ -196,7 +197,7 @@ double gravity_kick_integrand(double a, void *param) { ...@@ -196,7 +197,7 @@ double gravity_kick_integrand(double a, void *param) {
* @brief Computes \f$ dt / a^{3(\gamma - 1) + 1} \f$ for the current cosmology. * @brief Computes \f$ dt / a^{3(\gamma - 1) + 1} \f$ for the current cosmology.
* *
* @param a The scale-factor of interest. * @param a The scale-factor of interest.
* @param param The current #csomology. * @param param The current #cosmology.
*/ */
double hydro_kick_integrand(double a, void *param) { double hydro_kick_integrand(double a, void *param) {
...@@ -223,9 +224,10 @@ double hydro_kick_integrand(double a, void *param) { ...@@ -223,9 +224,10 @@ double hydro_kick_integrand(double a, void *param) {
* @brief Computes \f$ dt \f$ for the current cosmology. * @brief Computes \f$ dt \f$ for the current cosmology.
* *
* @param a The scale-factor of interest. * @param a The scale-factor of interest.
* @param param The current #csomology. * @param param The current #cosmology.
*/ */
double time_integrand(double a, void *param) { double time_integrand(double a, void *param) {
const struct cosmology *c = (const struct cosmology *)param; const struct cosmology *c = (const struct cosmology *)param;
const double Omega_r = c->Omega_r; const double Omega_r = c->Omega_r;
const double Omega_m = c->Omega_m; const double Omega_m = c->Omega_m;
...@@ -339,7 +341,7 @@ void cosmology_init_tables(struct cosmology *c) { ...@@ -339,7 +341,7 @@ void cosmology_init_tables(struct cosmology *c) {
* @brief Initialises the #cosmology from the values read in the parameter file. * @brief Initialises the #cosmology from the values read in the parameter file.
* *
* @param params The parsed values. * @param params The parsed values.
* @us The current internal system of units. * @param us The current internal system of units.
* @param phys_const The physical constants in the current system of units. * @param phys_const The physical constants in the current system of units.
* @param c The #cosmology to initialise. * @param c The #cosmology to initialise.
*/ */
...@@ -410,6 +412,7 @@ void cosmology_print(const struct cosmology *c) { ...@@ -410,6 +412,7 @@ void cosmology_print(const struct cosmology *c) {
* *
* Computes \f$ \int_{a_start}^{a_end} dt/a^2 \f$ using the interpolation table. * Computes \f$ \int_{a_start}^{a_end} dt/a^2 \f$ using the interpolation table.
* *
* @param e The #engine.
* @param ti_start the (integer) time of the start of the drift. * @param ti_start the (integer) time of the start of the drift.
* @param ti_end the (integer) time of the end of the drift. * @param ti_end the (integer) time of the end of the drift.
*/ */
...@@ -435,6 +438,7 @@ double cosmology_get_drift_factor(const struct engine *e, ...@@ -435,6 +438,7 @@ double cosmology_get_drift_factor(const struct engine *e,
* *
* Computes \f$ \int_{a_start}^{a_end} dt/a \f$ using the interpolation table. * Computes \f$ \int_{a_start}^{a_end} dt/a \f$ using the interpolation table.
* *
* @param e The #engine.
* @param ti_start the (integer) time of the start of the drift. * @param ti_start the (integer) time of the start of the drift.
* @param ti_end the (integer) time of the end of the drift. * @param ti_end the (integer) time of the end of the drift.
*/ */
...@@ -460,6 +464,7 @@ double cosmology_get_grav_kick_factor(const struct engine *e, ...@@ -460,6 +464,7 @@ double cosmology_get_grav_kick_factor(const struct engine *e,
* *
* Computes \f$ \int_{a_start}^{a_end} dt/a \f$ using the interpolation table. * Computes \f$ \int_{a_start}^{a_end} dt/a \f$ using the interpolation table.
* *
* @param e The #engine.
* @param ti_start the (integer) time of the start of the drift. * @param ti_start the (integer) time of the start of the drift.
* @param ti_end the (integer) time of the end of the drift. * @param ti_end the (integer) time of the end of the drift.
*/ */
......
...@@ -37,6 +37,9 @@ struct cosmology { ...@@ -37,6 +37,9 @@ struct cosmology {
/*! Inverse of the current expansion factor of the Universe */ /*! Inverse of the current expansion factor of the Universe */
double a_inv; double a_inv;
/*! Inverse cube of the current expansion factor of the Universe */
double a3_inv;
/*! Current redshift */ /*! Current redshift */
double z; double z;
...@@ -49,6 +52,8 @@ struct cosmology { ...@@ -49,6 +52,8 @@ struct cosmology {
/*! Dark-energy equation of state at the current time */ /*! Dark-energy equation of state at the current time */
double w; double w;
/*------------------------------------------------------------------ */
/*! Starting expansion factor */ /*! Starting expansion factor */
double a_begin; double a_begin;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment