Fixed transpotion and the sign
This commit is contained in:
parent
7258dd20cb
commit
ae040d15ee
3 changed files with 39 additions and 16 deletions
|
@ -13,7 +13,7 @@ def gen_posgrid(N, L):
|
|||
y = ix[None,:,None].repeat(N, axis=0).repeat(N, axis=2)
|
||||
z = ix[None,None,:].repeat(N, axis=0).repeat(N, axis=1)
|
||||
|
||||
return x.flatten(), y.flatten(), z.flatten()
|
||||
return x.reshape((x.size,)), y.reshape((y.size,)), z.reshape((z.size,))
|
||||
|
||||
def bin_power(P, L, bins=20, range=(0,1.)):
|
||||
|
||||
|
@ -73,15 +73,17 @@ def run_generation(input_borg, a_borg, a_ic, cosmo, supersample=1, do_lpt2=True,
|
|||
D1_0 = D1/cgrowth.D(a_borg)
|
||||
velmul = cgrowth.compute_velmul(a_ic)
|
||||
|
||||
D2 = -3./7 * D1_0**2
|
||||
D2 = 3./7 * D1_0**2
|
||||
|
||||
for j in xrange(3):
|
||||
# Generate psi_j (displacement along j)
|
||||
print("LPT1 axis=%d" % j)
|
||||
psi = D1_0*lpt.lpt1(j).flatten()
|
||||
psi = D1_0*lpt.lpt1(j)
|
||||
psi = psi.reshape((psi.size,))
|
||||
if do_lpt2:
|
||||
print("LPT2 axis=%d" % j)
|
||||
psi += D2 * lpt.lpt2(j).flatten()
|
||||
psi2 = lpt.lpt2(j)
|
||||
psi += D2 * psi2.reshape((psi2.size,))
|
||||
# Generate posx
|
||||
posx.append(((posq[j] + psi)%L).astype(np.float32))
|
||||
# Generate vel
|
||||
|
@ -99,7 +101,9 @@ def write_icfiles(*generated_ic, **cosmo):
|
|||
|
||||
ct.simpleWriteGadget("borg.gad", posx, velocities=vel, boxsize=L, Hubble=cosmo['h'], Omega_M=cosmo['omega_M_0'], time=a_ic)
|
||||
for i,c in enumerate(["x","y","z"]):
|
||||
ct.writeGrafic("ic_velc%s" % c, vel[i].reshape((N,N,N)).transpose(), L, a_ic, **cosmo)
|
||||
ct.writeGrafic("ic_velc%s" % c, vel[i].reshape((N,N,N)), L, a_ic, **cosmo)
|
||||
# This used to be necessary. However this has been fixed in writeGrafic now
|
||||
# ct.writeGrafic("ic_velc%s" % c, vel[i].reshape((N,N,N)).transpose(), L, a_ic, **cosmo)
|
||||
|
||||
ct.writeGrafic("ic_deltab", density, L, a_ic, **cosmo)
|
||||
ct.writeWhitePhase("white.dat", density)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue