|
FML
|
This namespace contains things related to Lagrangian Perturbation Theory (displacement fields, reconstruction, initial conditions etc.) More...
Typedefs | |
| template<int N> | |
| using | FFTWGrid = FML::GRID::FFTWGrid<N> |
| template<class T > | |
| using | MPIParticles = FML::PARTICLE::MPIParticles<T> |
| using | FloatType = FML::GRID::FloatType |
Enumerations | |
| enum class | Dealiasing { None , Padding } |
| Padding evaluates nonlinear products on a larger mesh and crops the result. More... | |
Functions | |
| template<int N> | |
| void | from_LPT_potential_to_displacement_vector (const FFTWGrid< N > &phi, std::array< FFTWGrid< N >, N > &psi, double DoverDini) |
| Generate the displaceement field \( \Psi = \nabla \phi \) from the LPT potential \( \phi \). | |
| template<int N> | |
| void | compute_1LPT_potential_fourier (const FFTWGrid< N > &delta_fourier, FFTWGrid< N > &phi_1LPT_fourier) |
| Generate the 1LPT potential defined as \( \Psi^{\rm 1LPT} = \nabla \phi^{\rm 1LPT} \) and \(
\nabla^2 \phi^{\rm 1LPT} = -\delta \). | |
| template<int N> | |
| void | compute_2LPT_potential_fourier (const FFTWGrid< N > &delta_fourier, FFTWGrid< N > &phi_2LPT_fourier, Dealiasing dealiasing=Dealiasing::None) |
| Optional Padding uses a >=3N/2 work mesh for the quadratic source. | |
| template<int N> | |
| void | compute_3LPT_potential_fourier (const FFTWGrid< N > &delta_fourier, FFTWGrid< N > &phi_1LPT_fourier, FFTWGrid< N > &phi_2LPT_fourier, FFTWGrid< N > &phi_3LPT_a_fourier, FFTWGrid< N > &phi_3LPT_b_fourier, std::array< FFTWGrid< N >, N > &phi_3LPT_Avec_fourier, bool ignore_curl_term, Dealiasing dealiasing=Dealiasing::None) |
| Optional Padding uses a >=2N work mesh for all nonlinear sources, retaining the full intermediate second-order bandwidth until cropping. | |
| template<int N> | |
| void | compute_ALPT_potential_fourier (const FFTWGrid< N > &delta_fourier, const FFTWGrid< N > &phi_2LPT_fourier, FFTWGrid< N > &phi_ALPT_fourier, double smoothing_scale, std::string smoothing_method, double DoverDini_1LPT, double DoverDini_2LPT) |
| Generate the APT potential defined as \( \Psi = \Psi^L + \Psi^S \) where the long range is just a smoothed 1LPT+2LPT and the short range is the spherical collapse approximation. | |
| template<int N> | |
| void | compute_spherical_collapse_potential (const FFTWGrid< N > &delta_fourier, FFTWGrid< N > &phi_sc_fourier, double DoverDini_1LPT) |
| Take in an initial density field (generated at a redshift zini) and the corresponding ratio of growth factors D(z)/D(zini) produces the approximate spherical collapse potential defined via \( \nabla^2 \phi_{\rm SC} = 3(\sqrt{\max(1 - \frac{2}{3}\delta(x,z), 0)} - 1) \) at the redshift z with \( \delta(x,z) = \frac{D(z)}{D(z_{\rm ini})}\delta_{\rm ini}(x) \). | |
| template<int N> | |
| void | from_LPT_potential_to_displacement_vector_scaledependent (const FFTWGrid< N > &phi, std::array< FFTWGrid< N >, N > &psi, std::function< double(double)> DoverDini_of_k) |
| Function is the ratio of the scale-dependent growth-factor at the time we want to generate particles to the time where phi was generated at as function of k. | |
| template<int N> | |
| void | compute_3LPT_displacement_field (const FFTWGrid< N > &delta_fourier, std::array< FFTWGrid< N >, N > &Psi, std::array< FFTWGrid< N >, N > &dPsidt, double dlogDdt, bool ignore_curl_term, Dealiasing dealiasing) |
| The potential construction retains the first-order Hessian and streams the second-order Hessian in two batches through N work grids. | |
| template<int N, class T > | |
| void | assign_displacement_fields_scaledependent (MPIParticles< T > &part, FFTWGrid< N > &LPT_potential_fourier, std::function< double(double)> DoverDini_of_k, std::string LPT_potential_order) |
| This method assigns the displacement fields to particles for the case where we have scaledependent growth. | |
| void | compute_LPT_growth_factors_GeffGLCDM (double OmegaM, double zini, std::function< double(double)> HoverH0_of_a, std::function< double(double)> GeffOverG_of_a, FML::INTERPOLATION::SPLINE::Spline &D_1LPT_of_loga, FML::INTERPOLATION::SPLINE::Spline &D_2LPT_of_loga, FML::INTERPOLATION::SPLINE::Spline &D_3LPTa_of_loga, FML::INTERPOLATION::SPLINE::Spline &D_3LPTb_of_loga) |
| Compute 1,2,3LPT growth-factors in simple modified gravity models that have a GeffG(a) and spline them The growth factors are normalized such that D1LPT = 1 at zini We assume initial conditions as in EdS: D1LPT=1, D2LPT = -3/7, D3LPTa = -1/3 and D3LPTb = 5/21 NB: There should be a modified 2LPT+ kernel factor in general which we don't include here (model dependent) | |
| void | compute_LPT_growth_factors_LCDM (double OmegaM, double zini, std::function< double(double)> HoverH0_of_a, FML::INTERPOLATION::SPLINE::Spline &D_1LPT_of_loga, FML::INTERPOLATION::SPLINE::Spline &D_2LPT_of_loga, FML::INTERPOLATION::SPLINE::Spline &D_3LPTa_of_loga, FML::INTERPOLATION::SPLINE::Spline &D_3LPTb_of_loga) |
| Compute 1,2,3LPT growth-factors in LCDM and spline them The growth factors are normalized such that D1LPT = 1 at zini We assume initial conditions as in EdS: D1LPT=1, D2LPT = -3/7, D3LPTa = -1/3 and D3LPTb = 5/21. | |
| template<int N, class T > | |
| void | RSDReconstructionFourierMethod (MPIParticles< T > &part, std::string density_assignment_method, std::vector< double > los_direction, int Nmesh, int niterations, double beta, std::pair< std::string, double > smoothing_options, bool survey_data) |
| RSD removal for particles in a periodic box We use a fixed line of sight direction los_direction, typically coordinate axes (e.g. | |
This namespace contains things related to Lagrangian Perturbation Theory (displacement fields, reconstruction, initial conditions etc.)
| using FML::COSMOLOGY::LPT::FFTWGrid = FML::GRID::FFTWGrid<N> |
Definition at line 34 of file DisplacementFields.h.
| using FML::COSMOLOGY::LPT::FloatType = FML::GRID::FloatType |
Definition at line 27 of file Reconstruction.h.
| using FML::COSMOLOGY::LPT::MPIParticles = FML::PARTICLE::MPIParticles<T> |
Definition at line 36 of file DisplacementFields.h.
|
strong |
Padding evaluates nonlinear products on a larger mesh and crops the result.
None preserves the original, aliased calculation. Padding excludes input and output Nyquist planes (for even meshes); all strictly sub-Nyquist modes remain.
| Enumerator | |
|---|---|
| None | |
| Padding | |
Definition at line 12 of file Dealiasing.h.
| void FML::COSMOLOGY::LPT::assign_displacement_fields_scaledependent | ( | MPIParticles< T > & | part, |
| FFTWGrid< N > & | LPT_potential_fourier, | ||
| std::function< double(double)> | DoverDini_of_k, | ||
| std::string | LPT_potential_order ) |
This method assigns the displacement fields to particles for the case where we have scaledependent growth.
This is involved: we take phi_iLPT(zini,k) and use growth factors to go to phi_iLPT(z,k) and FFT to get phi_iLPT(z,q). Then we transport the particles back to their original CPU given by the particles Lagrangian position q and assign the displacement field before we move them back to their eulerian positions. This can be done more efficiently (we don't need to do this much communication) but this will come at the expense of a lot more code so fuck it. In practice to be efficient we should ideally do all orders at the same time otherwise we need to swap and do communication many times. This is how its done in our COLA code. So this method mainly shows how to do it.
| N | The dimension we are working in |
| T | The particle class. Must have a get_D_* with * being one or more of 1LPT, 2LPT, 3LPTa, 3LPTb to use this method. |
| [out] | part | The particle container. We assign the displacement fields to the particles we get in. |
| [in] | LPT_potential_fourier | The LPT potential phi(zini,k) at the initial redshift. |
| [in] | DoverDini_of_k | Ratio of the growth factors at the current time to that of the time of LPT_potential_fourier. |
| [in] | LPT_potential_order | 1LPT, 2LPT, 3LPTa or 3LPTb. Tells us what field in the particles we should store the data in |
Definition at line 1489 of file DisplacementFields.h.
| void FML::COSMOLOGY::LPT::compute_1LPT_potential_fourier | ( | const FFTWGrid< N > & | delta_fourier, |
| FFTWGrid< N > & | phi_1LPT_fourier ) |
Generate the 1LPT potential defined as \( \Psi^{\rm 1LPT} = \nabla \phi^{\rm 1LPT} \) and \( \nabla^2 \phi^{\rm 1LPT} = -\delta \).
Returns it in Fourier space.
| N | The dimension of the grid |
| [in] | delta_fourier | The density contrast in fourier space |
| [out] | phi_1LPT_fourier | The LPT potential in fourier space |
Definition at line 300 of file DisplacementFields.h.
| void FML::COSMOLOGY::LPT::compute_2LPT_potential_fourier | ( | const FFTWGrid< N > & | delta, |
| FFTWGrid< N > & | phi_2LPT, | ||
| Dealiasing | dealiasing = Dealiasing::None ) |
Optional Padding uses a >=3N/2 work mesh for the quadratic source.
Generate the 2LPT potential defined as \( \Psi^{\rm 2LPT} = \nabla \phi^{\rm 2LPT} \) and \( \nabla^2 \phi^{\rm 2LPT} = \ldots \).
See LPT/README.md for Nyquist conventions, memory cost and examples.
Returns the grid in Fourier space.
| N | The dimension of the grid |
| [in] | delta | The density contrast in fourier space |
| [out] | phi_2LPT | The LPT potential in fourier space |
Definition at line 363 of file DisplacementFields.h.
| void FML::COSMOLOGY::LPT::compute_3LPT_displacement_field | ( | const FFTWGrid< N > & | delta_fourier, |
| std::array< FFTWGrid< N >, N > & | Psi, | ||
| std::array< FFTWGrid< N >, N > & | dPsidt, | ||
| double | dlogDdt, | ||
| bool | ignore_curl_term, | ||
| Dealiasing | dealiasing ) |
The potential construction retains the first-order Hessian and streams the second-order Hessian in two batches through N work grids.
With all 3D potentials and curl requested, its peak is about 17 full grids including the input, before caller-owned outputs and FFT workspace overhead. The units of the dlogDdt term is what sets the units of dPsidt In this methods the displacement field is assumed to be on the EdS/LCDM form Psi = D Psi1LPT + D^2 Psi2LPT + D^3 Psi3LPT i.e. each term multiplied with powers of D so we only have a single growth-factor D_nLPT = const * (D_1LPT)^n with the constants being 1, -3/7, 1/3, -10/21, ... (these are already included in the potentials returned by compute_3LPT_potential_fourier). The fields are returned at the time of delta_fourier: Psi = Psi1LPT + Psi2LPT + Psi3LPT and dPsidt = dlogDdt * (Psi1LPT + 2 Psi2LPT + 3 Psi3LPT).
| N | Dimensions we are working in (only 2 or 3) |
| [in] | delta_fourier | A realisation of the density field. |
| [out] | Psi | The displacement field |
| [out] | dPsidt | The derivative of the displacement field (units is that of the next factor) |
| [in] | dlogDdt | The logarithmic derivative of D at the time we want Psi in whatever units you want it to be. |
| [in] | ignore_curl_term | Don't include the transverse (curl) 3LPT term |
Definition at line 627 of file DisplacementFields.h.
| void FML::COSMOLOGY::LPT::compute_3LPT_potential_fourier | ( | const FFTWGrid< N > & | delta_fourier, |
| FFTWGrid< N > & | phi_1LPT_fourier, | ||
| FFTWGrid< N > & | phi_2LPT_fourier, | ||
| FFTWGrid< N > & | phi_3LPT_a_fourier, | ||
| FFTWGrid< N > & | phi_3LPT_b_fourier, | ||
| std::array< FFTWGrid< N >, N > & | phi_3LPT_Avec_fourier, | ||
| bool | ignore_curl_term, | ||
| Dealiasing | dealiasing ) |
Optional Padding uses a >=2N work mesh for all nonlinear sources, retaining the full intermediate second-order bandwidth until cropping.
The potential construction retains the first-order Hessian and streams the second-order Hessian in two batches through N work grids.
With all 3D potentials and curl requested, its peak is about 17 full grids including the input, before caller-owned outputs and FFT workspace overhead. The potentials we output are normalized such that we can get the displacement field as Psi = D phi_1LPT + D phi_2LPT + D phi_3LPT_a + D phi_3PT_b + D x A_3LPT
| N | Dimensions we are working in (only 2 or 3) |
| [in] | delta_fourier | A realisation of the density field. |
| [out] | phi_1LPT_fourier | The 1LPT displacement potential |
| [out] | phi_2LPT_fourier | The 2LPT displacement potential |
| [out] | phi_3LPT_a_fourier | The A 3LPT displacement potential |
| [out] | phi_3LPT_b_fourier | The B 3LPT displacement potential |
| [out] | phi_3LPT_Avec_fourier | The 3LPT displacement vector potential |
| [in] | ignore_curl_term | Don't compute the vector potential |
Definition at line 768 of file DisplacementFields.h.
| void FML::COSMOLOGY::LPT::compute_ALPT_potential_fourier | ( | const FFTWGrid< N > & | delta_fourier, |
| const FFTWGrid< N > & | phi_2LPT_fourier, | ||
| FFTWGrid< N > & | phi_ALPT_fourier, | ||
| double | smoothing_scale, | ||
| std::string | smoothing_method, | ||
| double | DoverDini_1LPT, | ||
| double | DoverDini_2LPT ) |
Generate the APT potential defined as \( \Psi = \Psi^L + \Psi^S \) where the long range is just a smoothed 1LPT+2LPT and the short range is the spherical collapse approximation.
| N | The dimension of the grid |
| [in] | delta_fourier | The density contrast in fourier space |
| [in] | phi_2LPT_fourier | The 2LPT potential in fourier space |
| [out] | phi_ALPT_fourier | The ALPT potential in fourier space |
| [in] | smoothing_scale | The smoothing scale in the unit of the boxsize |
| [in] | smoothing_method | The smoothing filter (gaussian, tophat, sharpk) |
| [in] | DoverDini_1LPT | The 1LPT growth-factor at the time we want phi_ALPT_fourier divide by the growth factor at the redshift delta_fourier is at |
| [in] | DoverDini_2LPT | The 2LPT growth-factor at the time we want phi_ALPT_fourier divide by the growth factor at the redshift delta_fourier is at |
Definition at line 1232 of file DisplacementFields.h.
|
inline |
Compute 1,2,3LPT growth-factors in simple modified gravity models that have a GeffG(a) and spline them The growth factors are normalized such that D1LPT = 1 at zini We assume initial conditions as in EdS: D1LPT=1, D2LPT = -3/7, D3LPTa = -1/3 and D3LPTb = 5/21 NB: There should be a modified 2LPT+ kernel factor in general which we don't include here (model dependent)
| [in] | OmegaM | Matter density parameter at z=0 |
| [in] | zini | The redshift we want D1LPT = 1 |
| [in] | HoverH0_of_a | The hubble function H(a)/H0 |
| [in] | GeffOverG_of_a | Newtons constant Geff/G as function of a |
| [out] | D_1LPT_of_loga | Spline of the 1LPT growth factor |
| [out] | D_2LPT_of_loga | Spline of the 2LPT growth factor |
| [out] | D_3LPTa_of_loga | Spline of the 3LPTa growth factor |
| [out] | D_3LPTb_of_loga | Spline of the 3LPTb growth factor |
The friction term dlogH/dloga is computed from HoverH0_of_a by a (central) numerical derivative so any background H(a) can be used (not only flat LCDM). The splines cover 1/1000 <= a <= 1.5.
Definition at line 1322 of file DisplacementFields.h.
|
inline |
Compute 1,2,3LPT growth-factors in LCDM and spline them The growth factors are normalized such that D1LPT = 1 at zini We assume initial conditions as in EdS: D1LPT=1, D2LPT = -3/7, D3LPTa = -1/3 and D3LPTb = 5/21.
| [in] | OmegaM | Matter density parameter at z=0 |
| [in] | zini | The redshift we want D1LPT = 1 |
| [in] | HoverH0_of_a | The hubble function H(a)/H0 |
| [out] | D_1LPT_of_loga | Spline of the 1LPT growth factor |
| [out] | D_2LPT_of_loga | Spline of the 2LPT growth factor |
| [out] | D_3LPTa_of_loga | Spline of the 3LPTa growth factor |
| [out] | D_3LPTb_of_loga | Spline of the 3LPTb growth factor |
The friction term dlogH/dloga is computed from HoverH0_of_a (numerical derivative) so this also works for e.g. wCDM backgrounds (OmegaM only enters the source term). The splines cover 1/1000 <= a <= 1.5.
Definition at line 1444 of file DisplacementFields.h.
| void FML::COSMOLOGY::LPT::compute_spherical_collapse_potential | ( | const FFTWGrid< N > & | delta_fourier, |
| FFTWGrid< N > & | phi_sc_fourier, | ||
| double | DoverDini_1LPT ) |
Take in an initial density field (generated at a redshift zini) and the corresponding ratio of growth factors D(z)/D(zini) produces the approximate spherical collapse potential defined via \( \nabla^2 \phi_{\rm SC} = 3(\sqrt{\max(1 - \frac{2}{3}\delta(x,z), 0)} - 1) \) at the redshift z with \( \delta(x,z) = \frac{D(z)}{D(z_{\rm ini})}\delta_{\rm ini}(x) \).
The displacement field is \( \Psi_{\rm SC} = \nabla\phi_{\rm SC} \), i.e. we return \( \phi_{\rm SC}(k) = -{\rm source}(k)/k^2 \) (with the k=0 mode set to zero). To linear order \( \phi_{\rm SC} = \phi_{\rm 1LPT} \).
| N | The dimension of the grid |
| [in] | delta_fourier | The density contrast in fourier space |
| [out] | phi_sc_fourier | The spherical collapse approximation potential in fourier space |
| [in] | DoverDini_1LPT | The 1LPT growth-factor at the time we want phi_ALPT_fourier divide by the growth factor at the redshift delta_fourier is at |
Definition at line 1164 of file DisplacementFields.h.
| void FML::COSMOLOGY::LPT::from_LPT_potential_to_displacement_vector | ( | const FFTWGrid< N > & | phi, |
| std::array< FFTWGrid< N >, N > & | psi, | ||
| double | DoverDini ) |
Generate the displaceement field \( \Psi = \nabla \phi \) from the LPT potential \( \phi \).
| N | The dimension of the grid |
| [in] | phi | The LPT potential in fourier space |
| [out] | psi | The displacement vector in real space |
| [in] | DoverDini | The growth factor at the time you want the displacement field to the growth factor at which phi is at |
Definition at line 221 of file DisplacementFields.h.
| void FML::COSMOLOGY::LPT::from_LPT_potential_to_displacement_vector_scaledependent | ( | const FFTWGrid< N > & | phi, |
| std::array< FFTWGrid< N >, N > & | psi, | ||
| std::function< double(double)> | DoverDini_of_k ) |
Function is the ratio of the scale-dependent growth-factor at the time we want to generate particles to the time where phi was generated at as function of k.
| N | The dimension of the grid |
| [in] | phi | The LPT potential in fourier space |
| [out] | psi | The displacement vector in real space |
| [in] | DoverDini_of_k | The function D(k,z)/D(k,zini) as function of k. |
Definition at line 135 of file DisplacementFields.h.
| void FML::COSMOLOGY::LPT::RSDReconstructionFourierMethod | ( | MPIParticles< T > & | part, |
| std::string | density_assignment_method, | ||
| std::vector< double > | los_direction, | ||
| int | Nmesh, | ||
| int | niterations, | ||
| double | beta, | ||
| std::pair< std::string, double > | smoothing_options, | ||
| bool | survey_data ) |
RSD removal for particles in a periodic box We use a fixed line of sight direction los_direction, typically coordinate axes (e.g.
los_direction = {0,0,1} ) We are solving the equation LPT equation \( \nabla(b\Psi) + \beta \nabla((b\Psi\cdot r)r) = -\delta_{\rm tracer} \) and assuming zero-curl (which is not perfectly true) of the second term so we can use Fourier methods. Then we subtract the RSD which is given by \( \Psi_{\rm rsd} = \beta (b\Psi\cdot r)r) \) Here \( \beta = f / b \) growth-rate over galaxy bias. The smoothing filter is a filter we apply to the density field in k-space. It is always applied (also when R is smaller than the grid spacing: e.g. a gaussian filter still damps the modes by exp(-k^2R^2/2)). Use R = 0 for no smoothing.
NB: the window of the density assignment (particles to grid) and of the interpolation of the displacement field back to the particles (CIC) are not deconvolved.
The iterative scheme of Burden et al. 2015 (arXiv:1504.02591): with \( s \) the observed (redshift-space) positions and \( x_0 = s \), iteration n computes \( b\Psi_n \) from the density of the positions \( x_{n-1} \) and sets \( x_n = s - \beta (b\Psi_n(s)\cdot r)r \). The first iteration overestimates the shift (the density is in redshift space); the iterations converge for \( \beta < 1 \) (3-5 iterations are enough).
Only a periodic box with a fixed line of sight is supported (survey_data = true, a line of sight towards an observer, is not implemented and aborts).
This method assumes scale-independent growth factor, but that is easily changed
| N | The dimension of the grid |
| T | The particle class |
| [out] | part | MPIParticles. Particles gets updated. |
| [in] | density_assignment_method | The density assignment method (NGP, CIC, TSC, PCS, PQS) |
| [in] | los_direction | The fixed line of sight direction, e.g. (0,0,1) for the z-axis |
| [in] | Nmesh | The size of the grid we use |
| [in] | niterations | How many iterations to do (not too many and not too few, 3 is good) |
| [in] | beta | This is beta = f/b the growth-rate over the bias |
| [in] | smoothing_options | The smoothing filter (gaussian, tophat, sharpk) and the smothing scale (in units of the boxsize) |
| [in] | survey_data | Must be false (survey data is not supported) |
Definition at line 84 of file Reconstruction.h.