rainwoodman / fastpm-python

Python version of FastPM
GNU General Public License v3.0
12 stars 8 forks source link

2lpt for multi fluid #12

Open energy-berkeley opened 7 years ago

energy-berkeley commented 7 years ago

For the problem in code line 214 # FIXME: Add 2LPT. According to Vlah, the 2LPT of CDM is the only,

Isn't it already fixed by:

    if order == 2:
        source1[...] /= Omega_tot
        source1[...] /= pt.D1(a) # goto z=0

        source2 = lpt2source(source1)

        for spname, sp in species.items():
            DX2 = lpt1(source2, Q)
            sp.S[...] += pt.D2(a) * DX2
            sp.V[...] += a ** 2 * pt.f2(a) * pt.E(a) * pt.D2(a) * DX2

    state = StateVector(self.cosmology, species, self.pm.comm)
    state.a['S'] = a
    state.a['P'] = a
rainwoodman commented 7 years ago

This is not exactly correct -- but likely good enough. Feel free to update the comment in the code.