Commit 17096ce7 authored by lhausamm's avatar lhausamm
Browse files

Add protype of testReading with cooling

parent b41060a4
......@@ -33,7 +33,7 @@ void cooling_read_particles(struct part* parts, struct io_props* list,
*num_fields += 1;
/* List what we want to read */
list[0] = io_make_input_field("HeDensity", FLOAT, 1, OPTIONAL,
list[0] = io_make_input_field("HeDensity", FLOAT, 1, COMPULSORY,
UNIT_CONV_DENSITY, parts, cooling_data.He_density);
}
......
......@@ -17,7 +17,7 @@
# Add the source directory and debug to CFLAGS
AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS)
AM_LDFLAGS = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS) $(FFTW_LIBS)
AM_LDFLAGS = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS) $(FFTW_LIBS) $(GRACKLE_LIBS)
# List of programs and scripts to run in the test suite
TESTS = testGreetings testMaths testReading.sh testSingle testKernel testSymmetry \
......
......@@ -37,6 +37,7 @@ fileName = "input.hdf5"
numPart = L**3
mass = boxSize**3 * rho / numPart
internalEnergy = P / ((gamma - 1.)*rho)
he_density = rho * 0.24
#Generate particles
coords = zeros((numPart, 3))
......@@ -45,6 +46,7 @@ m = zeros((numPart, 1))
h = zeros((numPart, 1))
u = zeros((numPart, 1))
ids = zeros((numPart, 1), dtype='L')
he = zeros((numPart, 1))
for i in range(L):
for j in range(L):
......@@ -63,7 +65,7 @@ for i in range(L):
h[index] = 2.251 * boxSize / L
u[index] = internalEnergy
ids[index] = index
he[index] = he_density
#--------------------------------------------------
......@@ -110,5 +112,7 @@ ds = grp.create_dataset('InternalEnergy', (numPart,1), 'f')
ds[()] = u
ds = grp.create_dataset('ParticleIDs', (numPart, 1), 'L')
ds[()] = ids
ds = grp.create_dataset('HeDensity', (numPart, 1), 'f')
ds[()] = he
file.close()
......@@ -42,6 +42,7 @@ int main() {
const double boxSize = 1.;
const size_t L = 4;
const double rho = 2.;
const float He_density = rho * 0.24;
/* Read data */
read_ic_single("input.hdf5", &us, dim, &parts, &gparts, &sparts, &Ngas,
......@@ -92,6 +93,13 @@ int main() {
assert(parts[n].a_hydro[0] == 0.);
assert(parts[n].a_hydro[1] == 0.);
assert(parts[n].a_hydro[2] == 0.);
#ifdef COOLING_GRACKLE
printf("Test %g, %g, %g\n", parts[n].cooling_data.He_density,
He_density,
parts[n].cooling_data.He_density-He_density);
assert(parts[n].cooling_data.He_density == He_density);
#endif
}
/* Clean-up */
......
Markdown is supported
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