unit test fixes for gizmo
I tried to fix the unit tests for gizmo. The changes include:
for test125cells.c
:
- added
hydro_get_drifted_comoving_entropy()
- removed
p->primitives
calls - minor change in matrix inversion so that FPEs caused by optimatization vectorization don't get thrown
Some problems remain:
- the
test125cells
codes now compile, but fail for gizmo (both perturbed and not). I found that the issue is due to the following call sequence in the tests:runner_do_ghost
->hydro_end_density
->gizmo_check_physical_quantities("density", "pressure", ...)
. The issue is that we run the tests with pressure = 0, while thegizmo_check_physical_quantities("density", "pressure", ...)
sets all the quantities to zero if either density or pressure is zero. Consequently, the results we obtain are all zeros and don't correspond to the expected results. -
testDistance
fails with an amusing FPE on a function call torunner_iact_gradient
:
Program received signal SIGFPE, Arithmetic exception.
compute_interaction (pi=pi@entry=0x7fffffff7440, pj=pj@entry=0x7fffffff75a0, a=a@entry=0.874422371, H=H@entry=1) at testDistance.c:45
45 runner_iact_gradient(r2, dx, pi->h, pj->h, pi, pj, a, H);
(gdb) bt
#0 compute_interaction (pi=pi@entry=0x7fffffff7440, pj=pj@entry=0x7fffffff75a0, a=a@entry=0.874422371, H=H@entry=1) at testDistance.c:45
#1 0x000000000040481e in test () at testDistance.c:86
#2 0x000000000040121b in main (argc=<optimized out>, argv=<optimized out>) at testDistance.c:115
(gdb) bt -full
#0 compute_interaction (pi=pi@entry=0x7fffffff7440, pj=pj@entry=0x7fffffff75a0, a=a@entry=0.874422371, H=H@entry=1) at testDistance.c:45
dx = <optimized out>
r2 = 0
#1 0x000000000040481e in test () at testDistance.c:86
dist = 1.1102230246251565e-16
a = 0.874422371
pi = {id = 1, gpart = 0x3fcd173b3eec8703, x = {1, 1, 1}, v = {1.65417445, 0.839894652, 1.11734307}, a_hydro = {1.58679295, 0.210568845,
0.530926287}, h = 1, rho = 1.62566435, fluid_v = {0.823569238, 1.77436113, 1.22701502}, P = 1.09857762, gradients = {rho = {0.13615799,
0.680664539, 0.225050941}, v = {{1.32087302, 2.10927844, 0.595476687}, {0.951857388, 0.485324681, 0.200472012}, {0.0985193178, 1.00090909,
-0.174431801}}, P = {1.32627547, 1.75081646, 0.520672679}}, limiter = {rho = {1.07563031, 1.73433363}, v = {{1.0797925, 1.2804631}, {
0.201411277, 1.43277526}, {0.0439262949, 0.712438345}}, P = {0.608343363, 1.25963783}, maxr = 1.95235455}, conserved = {mass = 1.00651586,
momentum = {1.61357391, 1.73155534, 0.713239431}, energy = 1.98578143}, flux = {mass = -1.57202208, momentum = {-4.23501062, -6.14694023,
-5.35991955}, energy = -1.67889082}, geometry = {volume = 22.7440453, matrix_E = {{1.79893911, 0.473801106, 0.490326792}, {1.39311314,
1.94638669, 0.418962389}, {0.633868814, 0.785737932, 0.339013278}}, centroid = {1.96166968, 0.624296069, 1.76509833}, wcorr = 1.51331949},
timestepvars = {vmax = 4.31173944}, density = {wcount_dh = -65.0863037, wcount = 22.8159084}, force = {h_dt = -0.254786313}, gravity = {mflux = {
0.121303439, 0.869624853, 0.812599719}}, chemistry_data = {<No data fields>}, cooling_data = {<No data fields>},
feedback_data = {<No data fields>}, black_holes_data = {<No data fields>}, rt_data = {<No data fields>}, time_bin = 1 '\001', limiter_data = {
wakeup = 103 'g', min_ngb_time_bin = -126 '\202', to_be_synchronized = 62 '>'}, ti_drift = 4607525248450393570, ti_kick = 4541038016520198065}
pj = {id = 2, gpart = 0x3f32e0053f337d4d, x = {1, 1, 1}, v = {1.33909285, 0.401491076, 1.19135118}, a_hydro = {1.78670251, 0.264216661, 1.04054046},
h = 1, rho = 1.07563031, fluid_v = {1.22793579, 1.43277526, 0.690774322}, P = 1.25963783, gradients = {rho = {0.745930374, -0.0694625825,
0.256979734}, v = {{0.246630967, 2.12788367, 1.1072768}, {-0.10821642, 1.19020498, 1.11706662}, {0.680123568, -0.232207835, -0.0172555186}},
P = {1.85086727, 0.540192723, 0.801858664}}, limiter = {rho = {0.898849308, 1.62566435}, v = {{0.140785262, 0.823569238}, {1.10352314,
1.77436113}, {1.22701502, 1.22701502}}, P = {1.02556503, 1.09857762}, maxr = 1.40953422}, conserved = {mass = 1.95477438, momentum = {
0.246370137, 1.25038886, 0.199110627}, energy = 0.439746588}, flux = {mass = 4.39009809, momentum = {5.64900541, 8.52454376, 5.78367519},
energy = 5.6511035}, geometry = {volume = 23.2639294, matrix_E = {{1.485659, 0.39851591, 0.49073422}, {0.454811931, 0.433616906, 1.53534901}, {
0.129011005, 1.36861479, 0.760904372}}, centroid = {1.19829965, 0.815961957, 0.116796568}, wcorr = 1.93879414}, timestepvars = {
vmax = 4.31173944}, density = {wcount_dh = -64.4213257, wcount = 22.1974869}, force = {h_dt = 0.965191483}, gravity = {mflux = {0.576938152,
1.06616604, 0.972510278}}, chemistry_data = {<No data fields>}, cooling_data = {<No data fields>}, feedback_data = {<No data fields>},
black_holes_data = {<No data fields>}, rt_data = {<No data fields>}, time_bin = 1 '\001', limiter_data = {wakeup = 24 '\030',
min_ngb_time_bin = -28 '\344', to_be_synchronized = 63 '?'}, ti_drift = 4604337326152003958, ti_kick = 4609635219832479494}
#2 0x000000000040121b in main (argc=<optimized out>, argv=<optimized out>) at testDistance.c:115
i = 0
cpufreq = 0
seed = 1644229797
__FUNCTION__ = "main"
But at least the tests compile now.
Edited by Mladen Ivkovic