Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
b8b3e792
Commit
b8b3e792
authored
7 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added 1/a^3 as one of the commonly tracked variables.
parent
59da0571
No related branches found
No related tags found
1 merge request
!509
Cosmological time integration
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
configure.ac
+1
-1
1 addition, 1 deletion
configure.ac
src/cosmology.c
+10
-5
10 additions, 5 deletions
src/cosmology.c
src/cosmology.h
+5
-0
5 additions, 0 deletions
src/cosmology.h
with
16 additions
and
6 deletions
configure.ac
+
1
−
1
View file @
b8b3e792
...
...
@@ -407,7 +407,7 @@ AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR(something is wrong with the math library!))
# Check for GSL
have_gsl="no"
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.
AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
...
...
This diff is collapsed.
Click to expand it.
src/cosmology.c
+
10
−
5
View file @
b8b3e792
...
...
@@ -120,6 +120,7 @@ void cosmology_update(struct cosmology *c, const struct engine *e) {
const
double
a_inv
=
1
.
/
a
;
c
->
a
=
a
;
c
->
a_inv
=
a_inv
;
c
->
a3_inv
=
a_inv
*
a_inv
*
a_inv
;
/* Redshift */
c
->
z
=
a_inv
-
1
.;
...
...
@@ -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.
*
* @param a The scale-factor of interest.
* @param param The current #c
s
omology.
* @param param The current #co
s
mology.
*/
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.
*
* @param a The scale-factor of interest.
* @param param The current #c
s
omology.
* @param param The current #co
s
mology.
*/
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.
*
* @param a The scale-factor of interest.
* @param param The current #c
s
omology.
* @param param The current #co
s
mology.
*/
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.
*
* @param a The scale-factor of interest.
* @param param The current #c
s
omology.
* @param param The current #co
s
mology.
*/
double
time_integrand
(
double
a
,
void
*
param
)
{
const
struct
cosmology
*
c
=
(
const
struct
cosmology
*
)
param
;
const
double
Omega_r
=
c
->
Omega_r
;
const
double
Omega_m
=
c
->
Omega_m
;
...
...
@@ -339,7 +341,7 @@ void cosmology_init_tables(struct cosmology *c) {
* @brief Initialises the #cosmology from the values read in the parameter file.
*
* @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 c The #cosmology to initialise.
*/
...
...
@@ -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.
*
* @param e The #engine.
* @param ti_start the (integer) time of the start 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,
*
* 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_end the (integer) time of the end of the drift.
*/
...
...
@@ -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.
*
* @param e The #engine.
* @param ti_start the (integer) time of the start of the drift.
* @param ti_end the (integer) time of the end of the drift.
*/
...
...
This diff is collapsed.
Click to expand it.
src/cosmology.h
+
5
−
0
View file @
b8b3e792
...
...
@@ -37,6 +37,9 @@ struct cosmology {
/*! Inverse of the current expansion factor of the Universe */
double
a_inv
;
/*! Inverse cube of the current expansion factor of the Universe */
double
a3_inv
;
/*! Current redshift */
double
z
;
...
...
@@ -49,6 +52,8 @@ struct cosmology {
/*! Dark-energy equation of state at the current time */
double
w
;
/*------------------------------------------------------------------ */
/*! Starting expansion factor */
double
a_begin
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment