File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) {
5656 struct cosmology cosmo ;
5757 cosmology_init (& params , & us , & phys_const , & cosmo );
5858
59- message ("Start checking computation..." );
59+ message ("Start checking time since big bang computation..." );
6060
6161 for (int i = 0 ; i < N_CHECK ; i ++ ) {
6262 double a = 0.1 + 0.9 * i / (N_CHECK - 1. );
@@ -70,6 +70,20 @@ int main(int argc, char *argv[]) {
7070 assert (fabs (tmp ) < TOLERANCE );
7171 }
7272
73+ message ("Start checking comoving distance computation..." );
74+
75+ for (int i = 0 ; i < N_CHECK ; i ++ ) {
76+ double a = 0.1 + 0.9 * i / (N_CHECK - 1. );
77+ /* Compute a(comoving_distance(a)) and check if same results */
78+ double tmp = cosmology_get_comoving_distance (& cosmo , a );
79+ tmp = cosmology_scale_factor_at_comoving_distance (& cosmo , tmp );
80+
81+ /* check accuracy */
82+ tmp = (tmp - a ) / a ;
83+ message ("Accuracy of %g at a=%g" , tmp , a );
84+ assert (fabs (tmp ) < TOLERANCE );
85+ }
86+
7387 message ("Everything seems fine with cosmology." );
7488
7589 cosmology_clean (& cosmo );
You can’t perform that action at this time.
0 commit comments