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[]) {
56
56
struct cosmology cosmo ;
57
57
cosmology_init (& params , & us , & phys_const , & cosmo );
58
58
59
- message ("Start checking computation..." );
59
+ message ("Start checking time since big bang computation..." );
60
60
61
61
for (int i = 0 ; i < N_CHECK ; i ++ ) {
62
62
double a = 0.1 + 0.9 * i / (N_CHECK - 1. );
@@ -70,6 +70,20 @@ int main(int argc, char *argv[]) {
70
70
assert (fabs (tmp ) < TOLERANCE );
71
71
}
72
72
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
+
73
87
message ("Everything seems fine with cosmology." );
74
88
75
89
cosmology_clean (& cosmo );
You can’t perform that action at this time.
0 commit comments