Skip to content

CoLoRe-2LPT: 2LPT velocities added for particles, tracers and beams#74

Open
damonge wants to merge 1 commit into
masterfrom
colore-2lpt
Open

CoLoRe-2LPT: 2LPT velocities added for particles, tracers and beams#74
damonge wants to merge 1 commit into
masterfrom
colore-2lpt

Conversation

@damonge
Copy link
Copy Markdown
Owner

@damonge damonge commented Mar 26, 2026

Copy link
Copy Markdown
Owner Author

@damonge damonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some preliminary comments. Ignore for now.

Comment thread src/common.h
Comment thread src/srcs.c
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!
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise this will have the wrong dz_rsd if you don't have skewers, right?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/srcs.c
Comment on lines 661 to 680
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you take my comment above you don't need to do any of this

Comment thread src/srcs.c
Comment thread Makefile
Comment thread src/density.c
}
if(p<0) p+=par->l_box;
if(p>=par->l_box) p-=par->l_box;
digrad[3+ax][index_nopad]=p;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/density.c
Comment thread src/density.c
Comment on lines +1261 to 1265
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);
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the indices here if we use my trick above to avoid additional arrays

Comment thread src/density.c
Comment on lines +1273 to +1275
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);
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto about indices

Comment thread src/density.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants