CoLoRe-2LPT: 2LPT velocities added for particles, tracers and beams#74
CoLoRe-2LPT: 2LPT velocities added for particles, tracers and beams#74damonge wants to merge 1 commit into
Conversation
damonge
left a comment
There was a problem hiding this comment.
Some preliminary comments. Ignore for now.
| double dz_rsd=rvel*get_bg(par,rr,BG_V1,0); | ||
| double dz_rsd; | ||
| if (par->lpt_vzty) { | ||
| dz_rsd=par->grid_velx[index]; // This is simply for consistency with the Snapshot Version. Note that the true dz_rsd will be computed in the skewers! |
There was a problem hiding this comment.
hummm, why not do this properly? Here you are assigning it the velocity in the x-direction. I would prefer if instead we modify get_rvel to get the 2LPT velocity if necessary.
There was a problem hiding this comment.
Otherwise this will have the wrong dz_rsd if you don't have skewers, right?
There was a problem hiding this comment.
I see, when you say skewers you mean beaming in general. However, for some cases (when you don't need skewers or lensing, for example), beaming is skipped altogether for speed, so you'd get the wrong dz_rsd in that case.
There was a problem hiding this comment.
If you take my comment above you don't need to do any of this
| } | ||
| if(p<0) p+=par->l_box; | ||
| if(p>=par->l_box) p-=par->l_box; | ||
| digrad[3+ax][index_nopad]=p; |
There was a problem hiding this comment.
Here we could assign this to digrad[ax][index] instead of digrad[ax+3][index_nopad], I think. In principle we use digrad[ax] to calculate displacements and velocities, but digrad[ax][index] has already been used and won't be used again. We can then use digrad[ax+3] to store the velocities and avoid having to allocate additional arrays
| digrad[3],digrad[4],digrad[5],digrad[6],digrad[7],digrad[8],&np_here); | ||
| } else { | ||
| share_particles(par,(unsigned long long)(2*dsize_buff), | ||
| (unsigned long long)(par->nz_here*((long)(par->n_grid*par->n_grid))), | ||
| digrad[3],digrad[4],digrad[5],&np_here); |
There was a problem hiding this comment.
Change the indices here if we use my trick above to avoid additional arrays
| pos_2_dens_2lpt(par,np_here,digrad[3],digrad[4],digrad[5],par->grid_dens,digrad[6], digrad[7], digrad[8], par->grid_velx, par->grid_vely, par->grid_velz); | ||
| } else { | ||
| pos_2_dens(par,np_here,digrad[3],digrad[4],digrad[5],par->grid_dens); |
By @mruizherrerab