Commit 4967ef03 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'correct_ICs' into 'master'

Corrected the IC generation scripts

IC generation scripts now create files that can be read without problems with the MPI parallel version of the HDF5 library.

Solves bug #23.

See merge request !11


Former-commit-id: 46c7cc9be9046ce69958a4f1a55fdef7ee628b43
parents e2d0c61e a952a987
......@@ -48,10 +48,10 @@ if L%2 == 0:
#Generate particles
coords = zeros((numPart, 3))
v = zeros((numPart, 3))
m = zeros((numPart, 1))
h = zeros((numPart, 1))
u = zeros((numPart, 1))
ids = zeros((numPart, 1), dtype='L')
m = zeros(numPart)
h = zeros(numPart)
u = zeros(numPart)
ids = zeros(numPart, dtype='L')
for i in range(L):
for j in range(L):
......@@ -100,17 +100,11 @@ grp.attrs["PeriodicBoundariesOn"] = periodic
#Particle group
grp = file.create_group("/PartType0")
ds = grp.create_dataset('Coordinates', (numPart, 3), 'd')
ds[()] = coords
ds = grp.create_dataset('Velocities', (numPart, 3), 'f')
ds[()] = v
ds = grp.create_dataset('Masses', (numPart,1), 'f')
ds[()] = m
ds = grp.create_dataset('SmoothingLength', (numPart,1), 'f')
ds[()] = h
ds = grp.create_dataset('InternalEnergy', (numPart,1), 'f')
ds[()] = u
ds = grp.create_dataset('ParticleIDs', (numPart, 1), 'L')
ds[()] = ids
grp.create_dataset('Coordinates', data=coords, dtype='d')
grp.create_dataset('Velocities', data=v, dtype='f')
grp.create_dataset('Masses', data=m, dtype='f')
grp.create_dataset('SmoothingLength', data=h, dtype='f')
grp.create_dataset('InternalEnergy', data=u, dtype='f')
grp.create_dataset('ParticleIDs', data=ids, dtype='L')
file.close()
......@@ -50,10 +50,10 @@ hbox = boxSize / L
#Generate particles
coords = zeros((numPart, 3))
v = zeros((numPart, 3))
m = zeros((numPart, 1))
h = zeros((numPart, 1))
u = zeros((numPart, 1))
ids = zeros((numPart, 1), dtype='L')
m = zeros(numPart)
h = zeros(numPart)
u = zeros(numPart)
ids = zeros(numPart, dtype='L')
for i in range(L):
for j in range(L):
......@@ -103,17 +103,11 @@ grp.attrs["PeriodicBoundariesOn"] = periodic
#Particle group
grp = file.create_group("/PartType0")
ds = grp.create_dataset('Coordinates', (numPart, 3), 'd')
ds[()] = coords
ds = grp.create_dataset('Velocities', (numPart, 3), 'f')
ds[()] = v
ds = grp.create_dataset('Masses', (numPart,1), 'f')
ds[()] = m
ds = grp.create_dataset('SmoothingLength', (numPart,1), 'f')
ds[()] = h
ds = grp.create_dataset('InternalEnergy', (numPart,1), 'f')
ds[()] = u
ds = grp.create_dataset('ParticleIDs', (numPart, 1), 'L')
ds[()] = ids
grp.create_dataset('Coordinates', data=coords, dtype='d')
grp.create_dataset('Velocities', data=v, dtype='f')
grp.create_dataset('Masses', data=m, dtype='f')
grp.create_dataset('SmoothingLength', data=h, dtype='f')
grp.create_dataset('InternalEnergy', data=u, dtype='f')
grp.create_dataset('ParticleIDs', data=ids, dtype='L')
file.close()
......@@ -61,9 +61,9 @@ coord1 = append(coord1, coord1 + [0.25, 0, 0], 0)
# coord1 = append(coord1, pos1 + [0, 0.5, 0.5], 0)
N1 = size(coord1)/3
v1 = zeros((N1, 3))
h1 = ones((N1, 1)) * 2.251 * 0.5 * vol / (size(pos1)/3)**(1./3.)
u1 = ones((N1, 1)) * P1 / ((gamma - 1.) * rho1)
m1 = ones((N1, 1)) * vol * 0.5 * rho1 / N1
h1 = ones(N1) * 2.251 * 0.5 * vol / (size(pos1)/3)**(1./3.)
u1 = ones(N1) * P1 / ((gamma - 1.) * rho1)
m1 = ones(N1) * vol * 0.5 * rho1 / N1
#Generate low density region
rho2 = 0.25
......@@ -74,9 +74,9 @@ coord2 = append(coord2, coord2 + [0.25, 0, 0], 0)
# coord2 = append(coord2, pos2 + [0, 0.5, 0.5], 0)
N2 = size(coord2)/3
v2 = zeros((N2, 3))
h2 = ones((N2, 1)) * 2.251 * 0.5 * vol / (size(pos2)/3)**(1./3.)
u2 = ones((N2, 1)) * P2 / ((gamma - 1.) * rho2)
m2 = ones((N2, 1)) * vol * 0.5 * rho2 / N2
h2 = ones(N2) * 2.251 * 0.5 * vol / (size(pos2)/3)**(1./3.)
u2 = ones(N2) * P2 / ((gamma - 1.) * rho2)
m2 = ones(N2) * vol * 0.5 * rho2 / N2
#Merge arrays
numPart = N1 + N2
......@@ -85,10 +85,13 @@ v = append(v1, v2,0)
h = append(h1, h2,0)
u = append(u1, u2,0)
m = append(m1, m2,0)
ids = zeros((numPart, 1), dtype='L')
ids = zeros(numPart, dtype='L')
for i in range(numPart):
ids[i] = i
#Final operations
h /= 2
#File
file = h5py.File(fileName, 'w')
......@@ -109,18 +112,13 @@ grp.attrs["PeriodicBoundariesOn"] = periodic
#Particle group
grp = file.create_group("/PartType0")
ds = grp.create_dataset('Coordinates', (numPart, 3), 'd')
ds[()] = coords
ds = grp.create_dataset('Velocities', (numPart, 3), 'f')
ds[()] = v
ds = grp.create_dataset('Masses', (numPart,1), 'f')
ds[()] = m
ds = grp.create_dataset('SmoothingLength', (numPart,1), 'f')
ds[()] = h / 2
ds = grp.create_dataset('InternalEnergy', (numPart,1), 'f')
ds[()] = u
ds = grp.create_dataset('ParticleIDs', (numPart,1), 'L')
ds[()] = ids[:]
grp.create_dataset('Coordinates', data=coords, dtype='d')
grp.create_dataset('Velocities', data=v, dtype='f')
grp.create_dataset('Masses', data=m, dtype='f')
grp.create_dataset('SmoothingLength', data=h, dtype='f')
grp.create_dataset('InternalEnergy', data=u, dtype='f')
grp.create_dataset('ParticleIDs', data=ids, dtype='L')
file.close()
......
......@@ -44,11 +44,11 @@ do
# Sedov blast
if [ ! -e SedovBlast_mindt_${cpu}.dump ]
then
./test_mindt -c 0.2 -t $cpu -f SedovBlast/sedov.hdf5 -m 0.1 -w 5000 -d 1e-10 > SedovBlast_${cpu}.dump
./test_mindt -c 0.2 -t $cpu -f SedovBlast/sedov.hdf5 -m 0.02 -w 5000 -d 1e-10 > SedovBlast_${cpu}.dump
fi
if [ ! -e SedovBlast_fixed_${cpu}.dump ]
then
./test_fixdt -r 4096 -t $cpu -f SedovBlast/sedov.hdf5 -m 0.1 -w 5000 -d 5e-5 > SedovBlast_fixed_${cpu}.dump
./test_fixdt -r 4096 -t $cpu -f SedovBlast/sedov.hdf5 -m 0.02 -w 5000 -d 5e-5 > SedovBlast_fixed_${cpu}.dump
fi
# Cosmological volume
......
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