FML
Typedefs | Functions | Variables
Main.cpp File Reference

Go to the source code of this file.

Typedefs

template<int N>
using FFTWGrid = FML::GRID::FFTWGrid< N >
 
using Particle = COLAParticle< NDIM >
 
using DVector = FML::SOLVERS::ODESOLVER::DVector
 
using ODEFunction = FML::SOLVERS::ODESOLVER::ODEFunction
 
using ODESolver = FML::SOLVERS::ODESOLVER::ODESolver
 
using FoFHalo = FML::FOF::FoFHalo< Particle, NDIM >
 

Functions

double HoverH0 (double a)
 
int main ()
 

Variables

const int NDIM = 3
 
const double box = 1000.0
 
const double zini = 20.0
 
const double aini = 1.0 / (1.0 + zini)
 
const double aend = 1.0
 
const int nsteps = 20
 
const bool fix_amplitude = true
 
const std::string type_of_random_field = "gaussian"
 
const double fNL = 100.0
 
const unsigned int random_seed = 1234
 
const int Nmesh = 256
 
const int Nmesh_IC = 128
 
const int Npart_1D = 128
 
const double buffer_factor = 1.5
 
const bool COLA = true
 
const int LPT_order_IC = 3
 
const int n_min_FoF_group = 20
 
const int Ngrid_max_FoF = 256
 
const double FoFBoundarySizeMpch
 
const double linking_length = 0.2
 
const int nbin_bispectrum = 16
 
const double apofk = 1.0
 
const std::string filename = "pofk.txt"
 
const std::string interpolation_method = "CIC"
 
const double OmegaM = 1.0
 
const double h = 0.7
 
const double A_s = 2e-9
 
const double n_s = 0.96
 
const double kpivot = 0.05 / h
 
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
 

Typedef Documentation

◆ DVector

Definition at line 82 of file Main.cpp.

◆ FFTWGrid

template<int N>
using FFTWGrid = FML::GRID::FFTWGrid<N>

Definition at line 80 of file Main.cpp.

◆ FoFHalo

Definition at line 85 of file Main.cpp.

◆ ODEFunction

Definition at line 83 of file Main.cpp.

◆ ODESolver

Definition at line 84 of file Main.cpp.

◆ Particle

using Particle = COLAParticle<NDIM>

Definition at line 81 of file Main.cpp.

Function Documentation

◆ HoverH0()

double HoverH0 ( double  a)

Definition at line 76 of file Main.cpp.

76{ return std::sqrt(OmegaM / (a * a * a) + 1.0 - OmegaM); };
const double OmegaM
Definition: Main.cpp:65

◆ main()

int main ( )

Definition at line 87 of file Main.cpp.

87 {
88
89 //========================================================
90 // If COLA then the particles must have get_D_nLPT method(s)
91 // This determines the LPT order we use with COLA
92 // The IC method will store the relevant stuff in the particles
93 //========================================================
94 int LPT_order_COLA = 0;
95 if (COLA) {
96 if constexpr (FML::PARTICLE::has_get_D_1LPT<Particle>())
97 LPT_order_COLA = 1;
98 if constexpr (FML::PARTICLE::has_get_D_2LPT<Particle>())
99 LPT_order_COLA = 2;
100 if constexpr (FML::PARTICLE::has_get_D_3LPTa<Particle>() or FML::PARTICLE::has_get_D_3LPTb<Particle>())
101 LPT_order_COLA = 3;
102 LPT_order_COLA = std::min(LPT_order_COLA, LPT_order_IC);
103 }
104
105 //========================================================
106 // We need a spline of the LPT growth factor(s)
107 // Normalized such that D1LPT(zini) = 1
108 //========================================================
109 FML::COSMOLOGY::LPT::compute_LPT_growth_factors_LCDM(
111
112 //============================================================
113 // Read k, P(k) (File has units of h/Mpc, (Mpc/h)^3 but what matters is that it has the same
114 // units as the boxsize)
115 //============================================================
116 std::ifstream fp(filename.c_str());
117 if (!fp.is_open())
118 throw std::runtime_error("Cannot open file: " + filename);
119 std::vector<double> logk;
120 std::vector<double> logpofk;
121 for (;;) {
122 double kin, pofkin;
123 fp >> kin;
124 if (fp.eof())
125 break;
126 fp >> pofkin;
127 logk.push_back(std::log(kin));
128 logpofk.push_back(std::log(pofkin));
129 }
130 // Make a spline and the P(k) function needed below
131 FML::INTERPOLATION::SPLINE::Spline logpofk_spline(logk, logpofk);
132
133 //============================================================
134 // Power spectrum scaled back to the initial time using growth-factors
135 // For non-gaussian initial conditions we also need the primordial
136 // power-spectrum
137 //============================================================
138 const double DiniOverD = D_1LPT_of_loga(std::log(aini)) / D_1LPT_of_loga(std::log(apofk));
139 auto Pofk_of_kBox_over_volume = [&](double kBox) {
140 const double logk = std::log(kBox / box);
141 const double volume = std::pow(box, NDIM);
142 return DiniOverD * DiniOverD * std::exp(logpofk_spline(logk)) / volume;
143 };
144 auto Pofk_of_kBox_over_volume_primordial = [&](double kBox) {
145 const double k = kBox / box;
146 return 2.0 * M_PI * M_PI / (kBox * kBox * kBox) * A_s * std::pow(k / kpivot, n_s - 1.0);
147 };
148 auto Pofk_of_kBox_over_Pofk_primordial = [&](double kBox) {
149 return Pofk_of_kBox_over_volume(kBox) / Pofk_of_kBox_over_volume_primordial(kBox);
150 };
151
152 //============================================================
153 // Hubble function and growth-rate(s) needed to compute IC
154 //============================================================
155 auto H_over_H0_of_loga = [&](double loga) { return HoverH0(std::exp(loga)); };
156 std::function<double(double)> growth_rate_f_1LPT_of_loga = [&](double loga) {
157 return D_1LPT_of_loga.deriv_x(loga) / D_1LPT_of_loga(loga);
158 };
159 std::function<double(double)> growth_rate_f_2LPT_of_loga = [&](double loga) {
160 return D_2LPT_of_loga.deriv_x(loga) / D_2LPT_of_loga(loga);
161 };
162 std::function<double(double)> growth_rate_f_3LPTa_of_loga = [&](double loga) {
163 return D_3LPTa_of_loga.deriv_x(loga) / D_3LPTa_of_loga(loga);
164 };
165 std::function<double(double)> growth_rate_f_3LPTb_of_loga = [&](double loga) {
166 return D_3LPTb_of_loga.deriv_x(loga) / D_3LPTb_of_loga(loga);
167 };
168 std::vector<std::function<double(double)>> growth_rate_f_of_loga;
169 growth_rate_f_of_loga.push_back(growth_rate_f_1LPT_of_loga);
170 growth_rate_f_of_loga.push_back(growth_rate_f_2LPT_of_loga);
171 growth_rate_f_of_loga.push_back(growth_rate_f_3LPTa_of_loga);
172 growth_rate_f_of_loga.push_back(growth_rate_f_3LPTb_of_loga);
173
174 //============================================================
175 // Set up random number generator
176 //============================================================
177 std::shared_ptr<FML::RANDOM::RandomGenerator> rng = std::make_shared<FML::RANDOM::RandomGenerator>();
178 rng->set_seed(random_seed);
179
180 //============================================================
181 // Generate initial conditions
182 //============================================================
183
184 std::vector<double> velocity_norms(4);
185 for (int i = 0; i < 4; i++) {
186 velocity_norms[i] =
187 100.0 * box * H_over_H0_of_loga(std::log(aini)) * aini * growth_rate_f_of_loga[i](std::log(aini));
188 }
189
191 FML::NBODY::NBodyInitialConditions<NDIM, Particle>(part,
192 Npart_1D,
194 Nmesh_IC,
196 rng.get(),
197 Pofk_of_kBox_over_Pofk_primordial,
198 Pofk_of_kBox_over_volume_primordial,
201 fNL,
202 box,
203 zini,
204 velocity_norms);
205
206 //============================================================
207 // In the COLA frame v=0 so reset velocities
208 //============================================================
209 if (COLA) {
210 // Loop over all active particles
211 for (auto & p : part) {
212 auto * vel = FML::PARTICLE::GetVel(p);
213 for (int idim = 0; idim < NDIM; idim++) {
214 vel[idim] = 0.0;
215 }
216 }
217 }
218
219 //============================================================
220 // Instead of stepping in dt_code = dt H0/a^2 we have unit time-steps in a. Here we
221 // compute the integral of dt_code/da over one time-step
222 //============================================================
223
224 // The prefactor to delta in the Poisson equation
225 auto poisson_factor = [&](double a) { return 1.5 * OmegaM * a; };
226
227 auto compute_vel_timestep = [&](double alow, double ahigh) {
228 // For the kick step we have an extra 'a' coming from the force via the Poisson equation
229 const double amid = (ahigh + alow) / 2.;
230 ODEFunction deriv = [&](double a, [[maybe_unused]] const double * t, double * dtda) {
231 dtda[0] = 1.0 / (a * a * a * HoverH0(a)) * poisson_factor(a) / poisson_factor(amid);
232 return GSL_SUCCESS;
233 };
234
235 // Solve the integral
236 DVector tini{0.0};
237 DVector avec{alow, ahigh};
238 ODESolver ode;
239 ode.solve(deriv, avec, tini);
240 return ode.get_final_data()[0];
241 };
242
243 auto compute_pos_timestep = [&](double alow, double ahigh) {
244 ODEFunction deriv = [&](double a, [[maybe_unused]] const double * t, double * dtda) {
245 dtda[0] = 1.0 / (a * a * a * HoverH0(a));
246 return GSL_SUCCESS;
247 };
248 // Solve the integral
249 DVector tini{0.0};
250 DVector avec{alow, ahigh};
251 ODESolver ode;
252 ode.solve(deriv, avec, tini);
253 return ode.get_final_data()[0];
254 };
255
256 //============================================================
257 // Main timestepping loop
258 //============================================================
259 for (int i = 0; i <= nsteps; i++) {
260
261 // Scale factor for velocity and positions. Equidistance steps in 'a'
262 const double delta_aexp = (aend - aini) / double(nsteps);
263 const double apos_old = aini + delta_aexp * i;
264 const double apos_new = (i == nsteps) ? aend : apos_old + delta_aexp;
265 const double avel_old = (i == 0) ? aini : apos_old - 0.5 * delta_aexp;
266 const double avel_new = (i == 0) ? aini + 0.5 * delta_aexp : (i == nsteps ? aend : apos_old + 0.5 * delta_aexp);
267
268 // Timesteps: first step we displace pos and vel by 1/2 timestep to do leapfrog
269 // Last time-step we synchronize back by only moving vel
270 const double delta_time_pos = compute_pos_timestep(apos_old, apos_new);
271 const double delta_time_vel = compute_vel_timestep(avel_old, avel_new);
272 const double norm_poisson_equation = poisson_factor(apos_old);
273
274 // Particles -> density field(x) -> density fielk(k)
276 FFTWGrid<NDIM> density_grid_fourier(Nmesh, nleftright.first, nleftright.second);
277 FML::INTERPOLATION::particles_to_grid(part.get_particles_ptr(),
278 part.get_npart(),
279 part.get_npart_total(),
280 density_grid_fourier,
282 density_grid_fourier.fftw_r2c();
283
284 // Here we can bin up a power-spectrum if we want (its basically free)
285 // Here we can also add contribution from radiation on large scales and linear massless neutrinos etc...
286
287 // Density field -> force
288 std::array<FFTWGrid<NDIM>, NDIM> force_real;
289 FML::NBODY::compute_force_from_density_fourier<NDIM>(
290 density_grid_fourier, force_real, interpolation_method, norm_poisson_equation);
291
292 // Update velocity of particles (frees force)
293 FML::NBODY::KickParticles<NDIM>(force_real, part, delta_time_vel, interpolation_method);
294
295 // Add on COLA displacement and velocity
296 if (COLA) {
297 const double D1new = D_1LPT_of_loga(std::log(apos_new));
298 const double D1old = D_1LPT_of_loga(std::log(apos_old));
299 const double D1ini = D_1LPT_of_loga(std::log(aini));
300 const double fac1_pos = (D1new - D1old) / D1ini;
301 const double fac1_vel = -norm_poisson_equation * D1old / D1ini * delta_time_vel;
302
303 const double D2new = D_2LPT_of_loga(std::log(apos_new));
304 const double D2old = D_2LPT_of_loga(std::log(apos_old));
305 const double D2ini = D_2LPT_of_loga(std::log(aini));
306 const double fac2_pos = (D2new - D2old) / D2ini;
307 const double fac2_vel = -norm_poisson_equation * (D2old - D1old * D1old) / D2ini * delta_time_vel;
308
309 const double D3anew = D_3LPTa_of_loga(std::log(apos_new));
310 const double D3aold = D_3LPTa_of_loga(std::log(apos_old));
311 const double D3aini = D_3LPTa_of_loga(std::log(aini));
312 const double fac3a_pos = (D3anew - D3aold) / D3aini;
313 const double fac3a_vel =
314 -norm_poisson_equation * (D3aold - 2.0 * D1old * D1old * D1old) / D3aini * delta_time_vel;
315
316 const double D3bnew = D_3LPTb_of_loga(std::log(apos_new));
317 const double D3bold = D_3LPTb_of_loga(std::log(apos_old));
318 const double D3bini = D_3LPTb_of_loga(std::log(aini));
319 const double fac3b_pos = (D3bnew - D3bold) / D3bini;
320 const double fac3b_vel =
321 -norm_poisson_equation * (D3bold + D1old * D1old * D1old - D1old * D2old) / D3bini * delta_time_vel;
322
323 // Loop over all active particles
324 for (auto & p : part) {
325 auto * pos = FML::PARTICLE::GetPos(p);
326 auto * vel = FML::PARTICLE::GetVel(p);
327
328 if (LPT_order_COLA >= 1) {
329 auto * D1 = FML::PARTICLE::GetD_1LPT(p);
330 for (int idim = 0; idim < NDIM; idim++) {
331 pos[idim] += D1[idim] * fac1_pos;
332 vel[idim] += D1[idim] * fac1_vel;
333 }
334 }
335
336 if (LPT_order_COLA >= 2) {
337 auto * D2 = FML::PARTICLE::GetD_2LPT(p);
338 for (int idim = 0; idim < NDIM; idim++) {
339 pos[idim] += D2[idim] * fac2_pos;
340 vel[idim] += D2[idim] * fac2_vel;
341 }
342 }
343
344 if constexpr (FML::PARTICLE::has_get_D_3LPTa<Particle>())
345 if (LPT_order_COLA >= 3) {
346 auto * D3a = FML::PARTICLE::GetD_3LPTa(p);
347 for (int idim = 0; idim < NDIM; idim++) {
348 pos[idim] += D3a[idim] * fac3a_pos;
349 vel[idim] += D3a[idim] * fac3a_vel;
350 }
351 }
352
353 if constexpr (FML::PARTICLE::has_get_D_3LPTb<Particle>())
354 if (LPT_order_COLA >= 3) {
355 auto * D3b = FML::PARTICLE::GetD_3LPTb(p);
356 for (int idim = 0; idim < NDIM; idim++) {
357 pos[idim] += D3b[idim] * fac3b_pos;
358 vel[idim] += D3b[idim] * fac3b_vel;
359 }
360 }
361 }
362 }
363
364 // Move particles (this does communication)
365 FML::NBODY::DriftParticles<NDIM, Particle>(part, delta_time_pos);
366
367 if (FML::ThisTask == 0)
368 std::cout << i << " / " << nsteps << " Positions at a: " << apos_new << " Velocities at a: " << avel_new
369 << "\n";
370
371 // Print info
372 part.info();
373 }
374
375 //============================================================
376 // For COLA we must add on the LPT velocity as we solve in
377 // the COLA frame
378 //============================================================
379
380 if (COLA) {
381 const double D1end = D_1LPT_of_loga(std::log(aend));
382 const double D1ini = D_1LPT_of_loga(std::log(aini));
383 const double D2end = D_2LPT_of_loga(std::log(aend));
384 const double D2ini = D_2LPT_of_loga(std::log(aini));
385 const double D3aend = D_3LPTa_of_loga(std::log(aend));
386 const double D3aini = D_3LPTa_of_loga(std::log(aini));
387 const double D3bend = D_3LPTb_of_loga(std::log(aend));
388 const double D3bini = D_3LPTb_of_loga(std::log(aini));
389 const double vfac_1LPT =
390 D1end / D1ini * growth_rate_f_1LPT_of_loga(std::log(aend)) * aend * aend * HoverH0(aend);
391 const double vfac_2LPT =
392 D2end / D2ini * growth_rate_f_2LPT_of_loga(std::log(aend)) * aend * aend * HoverH0(aend);
393 const double vfac_3LPTa =
394 D3aend / D3aini * growth_rate_f_3LPTa_of_loga(std::log(aend)) * aend * aend * HoverH0(aend);
395 const double vfac_3LPTb =
396 D3bend / D3bini * growth_rate_f_3LPTb_of_loga(std::log(aend)) * aend * aend * HoverH0(aend);
397
398 // Here we add on the COLA velocity kick
399 for (auto & p : part) {
400 auto * vel = FML::PARTICLE::GetVel(p);
401
402 if constexpr (FML::PARTICLE::has_get_D_1LPT<Particle>())
403 if (LPT_order_COLA >= 1) {
404 auto * D1 = FML::PARTICLE::GetD_1LPT(p);
405 for (int idim = 0; idim < NDIM; idim++) {
406 vel[idim] += D1[idim] * vfac_1LPT;
407 }
408 }
409
410 if constexpr (FML::PARTICLE::has_get_D_2LPT<Particle>())
411 if (LPT_order_COLA >= 2) {
412 auto * D2 = FML::PARTICLE::GetD_2LPT(p);
413 for (int idim = 0; idim < NDIM; idim++) {
414 vel[idim] += D2[idim] * vfac_2LPT;
415 }
416 }
417
418 if constexpr (FML::PARTICLE::has_get_D_3LPTa<Particle>())
419 if (LPT_order_COLA >= 3) {
420 auto * D3a = FML::PARTICLE::GetD_3LPTa(p);
421 for (int idim = 0; idim < NDIM; idim++) {
422 vel[idim] += D3a[idim] * vfac_3LPTa;
423 }
424 }
425
426 if constexpr (FML::PARTICLE::has_get_D_3LPTb<Particle>())
427 if (LPT_order_COLA >= 3) {
428 auto * D3b = FML::PARTICLE::GetD_3LPTb(p);
429 for (int idim = 0; idim < NDIM; idim++) {
430 vel[idim] += D3b[idim] * vfac_3LPTb;
431 }
432 }
433 }
434 }
435
436 //============================================================
437 // Compute power-spectrum at final redshift
438 //============================================================
439
440 if (FML::ThisTask == 0) {
441 std::cout << "Compute power spectrum\n";
442 }
443
444 const bool interlacing = true;
445 const std::string density_assignment = "CIC";
447 FML::CORRELATIONFUNCTIONS::compute_power_spectrum<NDIM>(Nmesh,
448 part.get_particles_ptr(),
449 part.get_npart(),
450 part.get_npart_total(),
451 pofk,
452 density_assignment,
453 interlacing);
454 pofk.scale(box);
455 if (FML::ThisTask == 0) {
456 std::ofstream fp("pofk_out.txt");
457 fp << "\n# k (h/Mpc) P(k) (Mpc/h)^3\n";
458 for (int i = 0; i < pofk.n; i++) {
459 fp << pofk.kbin[i] << " " << pofk.pofk[i] << "\n";
460 }
461 }
462
463 //============================================================
464 // Compute power-spectrum multipoles at final redshift
465 //============================================================
466
467 // Factor to convert from velocity v_code = a^2 dxdt / (H0 Box) to the RSD shift (dxdt / H) in units of the box
468 const double velocity_to_displacement = 1.0 / (aend * aend * HoverH0(aend));
469 const int ellmax = 4;
470 std::vector<FML::CORRELATIONFUNCTIONS::PowerSpectrumBinning<NDIM>> Pells(1 + ellmax, Nmesh / 2);
471 FML::CORRELATIONFUNCTIONS::compute_power_spectrum_multipoles<NDIM>(
472 Nmesh, part, velocity_to_displacement, Pells, density_assignment, interlacing);
473
474 // To physical units
475 for (size_t ell = 0; ell < Pells.size(); ell++) {
476 Pells[ell].scale(box);
477 }
478
479 // Output: k, P0, P0_kaiser P2, P2_kaiser, P4, P4_kaiser
480 if (FML::ThisTask == 0) {
481 FML::assert_mpi(Pells[0].n == pofk.n, "We require P(k) and Pell(k) to have the same bins");
482 std::ofstream fp("pofk_multipoles_out.txt");
483 const double f = growth_rate_f_1LPT_of_loga(std::log(aend));
484 for (int i = 0; i < Pells[0].n; i++) {
485 fp << Pells[0].k[i] << " ";
486 for (size_t ell = 0; ell < Pells.size(); ell += 2) {
487 fp << Pells[ell].pofk[i] << " ";
488
489 // Output the Kaiser limit relation between P(k) and P_ell(k)
490 if (ell == 0)
491 fp << pofk.pofk[i] * (1.0 + 2. * f / 3. + f * f / 5.) << " ";
492 if (ell == 2)
493 fp << pofk.pofk[i] * (4. * f / 3. + 4. * f * f / 7.) << " ";
494 if (ell == 4)
495 fp << pofk.pofk[i] * (8. * f * f / 35.) << " ";
496 }
497 fp << "\n";
498 }
499 fp << "\n";
500 }
501
502 //============================================================
503 // Compute bispectrum
504 //============================================================
506 0.0,
507 2.0 * M_PI * Nmesh / 2,
511 part.get_particles_ptr(),
512 part.get_npart(),
513 part.get_npart_total(),
514 bofk,
515 density_assignment,
516 interlacing);
517 bofk.scale(box);
518
519 if (FML::ThisTask == 0) {
520 std::ofstream fp("bofk_out.txt");
521 fp << "# k1 k2 k3 B123 Q123 N123\n";
522 for (int i = 0; i < nbin_bispectrum; i++) {
523 for (int j = 0; j < nbin_bispectrum; j++) {
524 for (int k = 0; k < nbin_bispectrum; k++) {
525 double k1 = bofk.kmean[i];
526 double k2 = bofk.kmean[j];
527 double k3 = bofk.kmean[k];
528 double B123 = bofk.get_spectrum(i, j, k);
529 double Q123 = bofk.get_reduced_spectrum(i, j, k);
530 double N123 = bofk.get_bincount(i, j, k);
531 fp << k1 << " " << k2 << " " << k3 << " " << B123 << " " << Q123 << " " << N123 << "\n";
532 }
533 }
534 }
535 }
536
537 //============================================================
538 // Locate halos
539 //============================================================
540
541 part.communicate_particles();
542 std::vector<FoFHalo> FoFGroups;
543 double bufferlength = FoFBoundarySizeMpch / box;
544 FML::FOF::FriendsOfFriends<Particle, NDIM>(part.get_particles_ptr(),
545 part.get_npart(),
548 true,
549 bufferlength,
550 FoFGroups,
552
553 // Output halos task by task
554 for (int i = 0; i < FML::NTasks; i++) {
555 if (i == FML::ThisTask) {
556 std::cout << "\n# Found " << FoFGroups.size() << " halos on task " << FML::ThisTask << "\n";
557 std::ofstream fp("halo_out.txt");
558 for (auto & g : FoFGroups) {
559 if (g.np > 0) {
560 fp << g.np << " ";
561 for (int idim = 0; idim < NDIM; idim++)
562 fp << g.pos[idim] * box << " ";
563 fp << "\n";
564 }
565 }
566 }
567#ifdef USE_MPI
568 MPI_Barrier(MPI_COMM_WORLD);
569#endif
570 }
571
572#ifdef MEMORY_LOGGING
573 // Show full info about allocations we as function of time
575#endif
576}
constexpr int NDIM
Definition: Main.cpp:46
SimpleParticle< Ndim > Particle
Definition: Main.cpp:54
const double box
Definition: Main.cpp:45
double HoverH0(double a)
Definition: Main.cpp:76
const int Ngrid_max_FoF
Definition: Main.cpp:56
const int nsteps
Definition: Main.cpp:43
const double apofk
Definition: Main.cpp:62
const unsigned int random_seed
Definition: Main.cpp:47
const int nbin_bispectrum
Definition: Main.cpp:61
FML::INTERPOLATION::SPLINE::Spline D_3LPTa_of_loga
Definition: Main.cpp:73
FML::INTERPOLATION::SPLINE::Spline D_2LPT_of_loga
Definition: Main.cpp:72
const std::string filename
Definition: Main.cpp:63
const std::string type_of_random_field
Definition: Main.cpp:45
const double A_s
Definition: Main.cpp:67
const int Npart_1D
Definition: Main.cpp:50
const double buffer_factor
Definition: Main.cpp:51
const bool fix_amplitude
Definition: Main.cpp:44
const double aend
Definition: Main.cpp:42
const int Nmesh
Definition: Main.cpp:48
const std::string interpolation_method
Definition: Main.cpp:64
const int n_min_FoF_group
Definition: Main.cpp:55
const double n_s
Definition: Main.cpp:68
const double kpivot
Definition: Main.cpp:69
FML::INTERPOLATION::SPLINE::Spline D_3LPTb_of_loga
Definition: Main.cpp:74
const double FoFBoundarySizeMpch
Definition: Main.cpp:57
const double linking_length
Definition: Main.cpp:59
const int Nmesh_IC
Definition: Main.cpp:49
const int LPT_order_IC
Definition: Main.cpp:53
const bool COLA
Definition: Main.cpp:52
const double zini
Definition: Main.cpp:40
FML::INTERPOLATION::SPLINE::Spline D_1LPT_of_loga
Definition: Main.cpp:71
const double fNL
Definition: Main.cpp:46
const double aini
Definition: Main.cpp:41
FML::INTERPOLATION::SPLINE::DVector DVector
Definition: Simulation.h:39
FML::SOLVERS::ODESOLVER::ODEFunction ODEFunction
Definition: Simulation.h:42
Class for storing the results from general polyspectrum.
Class for holding the results after binning up a power-spectrum.
Class for holding grids and performing real-to-complex and complex-to-real FFTs using FFTW with MPI.
Definition: FFTWGrid.h:88
This is a wrapper class for easy use of GSL splines It is (OpenMP) thread safe as long as splines are...
Definition: Spline.h:80
double deriv_x(double x) const
Get the value of the first derivative of the spline.
Definition: Spline.cpp:275
static MemoryLog * get()
Definition: MemoryLogging.h:86
A container class for holding particles that are distributed across many CPUs and to easily deal with...
Definition: MPIParticles.h:69
This is a wrapper around the GSL library to easily solve ODEs and return the data in whatever format ...
Definition: ODESolver.h:87
DVector get_final_data() const
Get the solution at the end point.
Definition: ODESolver.cpp:166
void solve(ODEFunctionPointer ode_equation, void *parameters, DVector &xarr, DVector &yinitial, const gsl_odeiv2_step_type *stepper=ODESOLVER_FIDUCIAL_STEPPER, ODEFunctionPointerJacobian jacobian=nullptr)
Definition: ODESolver.cpp:71
void compute_bispectrum(int Ngrid, T *part, size_t NumPart, size_t NumPartTotal, BispectrumBinning< N > &bofk, std::string density_assignment_method, bool interlacing)
Computes the bispectrum from particles.
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 D...
std::pair< int, int > get_extra_slices_needed_for_density_assignment(std::string density_assignment_method)
Compute how many extra slices we need in the FFTWGrid for a given density assignement / interpolation...
void particles_to_grid(const T *part, size_t NumPart, size_t NumPartTot, FFTWGrid< N > &density, std::string density_assignment_method)
Assign particles to a grid to compute the over density field delta.
get_vel constexpr double * GetPos(...)
constexpr double * GetD_3LPTa(...)
constexpr double * GetVel(...)
constexpr double * GetD_3LPTb(...)
constexpr double * GetD_2LPT(...)
Definition: CAMBReader.h:10
for(size_t i=0;i< n;i++)
Definition: Global.h:262
int ThisTask
The MPI task number.
Definition: Global.cpp:33
const double exp
Definition: Global.h:259
int NTasks
Total number of MPI tasks.
Definition: Global.cpp:34

Variable Documentation

◆ A_s

const double A_s = 2e-9

Definition at line 67 of file Main.cpp.

◆ aend

const double aend = 1.0

Definition at line 42 of file Main.cpp.

◆ aini

const double aini = 1.0 / (1.0 + zini)

Definition at line 41 of file Main.cpp.

◆ apofk

const double apofk = 1.0

Definition at line 62 of file Main.cpp.

◆ box

const double box = 1000.0

Definition at line 39 of file Main.cpp.

◆ buffer_factor

const double buffer_factor = 1.5

Definition at line 51 of file Main.cpp.

◆ COLA

const bool COLA = true

Definition at line 52 of file Main.cpp.

◆ D_1LPT_of_loga

Definition at line 71 of file Main.cpp.

◆ D_2LPT_of_loga

Definition at line 72 of file Main.cpp.

◆ D_3LPTa_of_loga

Definition at line 73 of file Main.cpp.

◆ D_3LPTb_of_loga

Definition at line 74 of file Main.cpp.

◆ filename

const std::string filename = "pofk.txt"

Definition at line 63 of file Main.cpp.

◆ fix_amplitude

const bool fix_amplitude = true

Definition at line 44 of file Main.cpp.

◆ fNL

const double fNL = 100.0

Definition at line 46 of file Main.cpp.

◆ FoFBoundarySizeMpch

const double FoFBoundarySizeMpch
Initial value:
=
3.0

Definition at line 57 of file Main.cpp.

◆ h

const double h = 0.7

Definition at line 66 of file Main.cpp.

◆ interpolation_method

const std::string interpolation_method = "CIC"

Definition at line 64 of file Main.cpp.

◆ kpivot

const double kpivot = 0.05 / h

Definition at line 69 of file Main.cpp.

◆ linking_length

const double linking_length = 0.2

Definition at line 59 of file Main.cpp.

◆ LPT_order_IC

const int LPT_order_IC = 3

Definition at line 53 of file Main.cpp.

◆ n_min_FoF_group

const int n_min_FoF_group = 20

Definition at line 55 of file Main.cpp.

◆ n_s

const double n_s = 0.96

Definition at line 68 of file Main.cpp.

◆ nbin_bispectrum

const int nbin_bispectrum = 16

Definition at line 61 of file Main.cpp.

◆ NDIM

const int NDIM = 3

Definition at line 38 of file Main.cpp.

◆ Ngrid_max_FoF

const int Ngrid_max_FoF = 256

Definition at line 56 of file Main.cpp.

◆ Nmesh

const int Nmesh = 256

Definition at line 48 of file Main.cpp.

◆ Nmesh_IC

const int Nmesh_IC = 128

Definition at line 49 of file Main.cpp.

◆ Npart_1D

const int Npart_1D = 128

Definition at line 50 of file Main.cpp.

◆ nsteps

const int nsteps = 20

Definition at line 43 of file Main.cpp.

◆ OmegaM

const double OmegaM = 1.0

Definition at line 65 of file Main.cpp.

◆ random_seed

const unsigned int random_seed = 1234

Definition at line 47 of file Main.cpp.

◆ type_of_random_field

const std::string type_of_random_field = "gaussian"

Definition at line 45 of file Main.cpp.

◆ zini

const double zini = 20.0

Definition at line 40 of file Main.cpp.