Added graficToDensity conversion. Added missing getBoxsize() method. Fixed grafic generation
This commit is contained in:
parent
688e4e20de
commit
1aaf5f4a13
5 changed files with 85 additions and 4 deletions
|
@ -49,13 +49,16 @@ def run_generation(input_borg, a_borg, a_ic, **cosmo):
|
|||
# Generate vel
|
||||
vel.append((psi*velmul).astype(np.float32))
|
||||
|
||||
return posx,vel,N,L,a_ic
|
||||
density = np.fft.irfftn(density_hat*D1_0)*(N/L)**3
|
||||
|
||||
return posx,vel,density,N,L,a_ic
|
||||
|
||||
def write_icfiles(*generated_ic, **cosmo):
|
||||
"""Write the initial conditions from the tuple returned by run_generation"""
|
||||
posx,vel,N,L,a_ic = generated_ic
|
||||
posx,vel,density,N,L,a_ic = generated_ic
|
||||
|
||||
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("borg.ic_velc%s" % c, vel[i].reshape((N,N,N)), L, a_ic, **cosmo)
|
||||
ct.writeGrafic("ic_velc%s" % c, vel[i].reshape((N,N,N)), L, a_ic, **cosmo)
|
||||
|
||||
ct.writeGrafic("ic_deltab", density, L, a_ic, **cosmo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue