Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
App_Var< T >::Impl< T > Class Template Reference
Collaboration diagram for App_Var< T >::Impl< T >:

Public Member Functions

 Impl (const Sim_Param &sim, const std::string &app_short, const std::string &app_long)
 
uint64_t alloc_mesh_vec (App_Var< T > &APP)
 
uint64_t alloc_bin_spec (App_Var< T > &APP)
 
uint64_t alloc_bin_corr (App_Var< T > &APP)
 
uint64_t alloc_particles (App_Var< T > &APP)
 
void fftw_prep (App_Var< T > &APP)
 
void set_init_pos (App_Var< T > &APP)
 
void set_init_cond (App_Var< T > &APP)
 
void print_sim_name () const
 
void print_end ()
 
std::string z_suffix () const
 
void print_input_realisation (App_Var< T > &APP)
 
void print_output (App_Var< T > &APP)
 
void create_work_dir (const Out_Opt &out_opt)
 
void integration (App_Var< T > &APP)
 

Public Attributes

const std::string app_str
 
const std::string app_long
 
const std::string z_suffix_const
 
const std::string out_dir_app
 
double a
 
double a_out
 
double da
 

Private Member Functions

bool printing () const
 
void print_info (const Sim_Param &sim) const
 
void print_position (const App_Var< T > &APP) const
 
void print_density (App_Var< T > &APP) const
 
void get_binned_power_spec (App_Var< T > &APP) const
 
void print_power_spec (App_Var< T > &APP)
 
void print_extrap_pwr (App_Var< T > &APP, const Extrap_Pk< double, 2 > &P_k) const
 
void print_corr (App_Var< T > &APP, const Extrap_Pk< double, 2 > &P_k) const
 
void print_vel_pwr (App_Var< T > &APP)
 
void print_init (App_Var< T > &APP)
 
bool integrate () const
 
void upd_time ()
 
double z () const
 

Private Attributes

unsigned int print_every
 
unsigned int step
 
Tracking track
 
Interp_obj pwr_spec_input
 
double D_init
 
double dDda_init
 
bool is_init_pwr_spec_0
 
bool is_init_vel_pwr_spec_0
 

Detailed Description

template<class T>
template<class T>
class App_Var< T >::Impl< T >

Definition at line 132 of file app_var.cpp.

Constructor & Destructor Documentation

template<class T>
template<class T >
App_Var< T >::Impl< T >::Impl ( const Sim_Param sim,
const std::string &  app_short,
const std::string &  app_long 
)
inline

Definition at line 136 of file app_var.cpp.

136  :
138  app_str(app_short), app_long(app_long), z_suffix_const("_" + app_short + "_"), out_dir_app(std_out_dir(app_short + "_run/", sim)),
139  track(4, sim.box_opt.par_num_1d),
140  a(sim.integ_opt.a_in), a_out(sim.integ_opt.a_out), da(sim.integ_opt.db),
142  {}
double a_in
Definition: params.hpp:73
bool is_init_vel_pwr_spec_0
Definition: app_var.cpp:429
std::string std_out_dir(const std::string &pre_subdir, const Sim_Param &sim)
Definition: core_out.cpp:53
const std::string app_str
Definition: app_var.cpp:233
Box_Opt box_opt
Definition: params.hpp:202
Tracking track
Definition: app_var.cpp:342
double a_out
Definition: app_var.cpp:323
const std::string app_long
Definition: app_var.cpp:233
bool is_init_pwr_spec_0
Definition: app_var.cpp:429
size_t par_num_1d
Definition: params.hpp:58
Integ_Opt integ_opt
Definition: params.hpp:203
Out_Opt out_opt
Definition: params.hpp:204
unsigned int print_every
Definition: app_var.cpp:341
const std::string out_dir_app
Definition: app_var.cpp:233
size_t print_every
Definition: params.hpp:85
double db
cmd args
Definition: params.hpp:72
unsigned int step
Definition: app_var.cpp:341
double a_out
derived parameters
Definition: params.hpp:73
const std::string z_suffix_const
Definition: app_var.cpp:233

Member Function Documentation

template<class T>
template<class T >
uint64_t App_Var< T >::Impl< T >::alloc_bin_corr ( App_Var< T > &  APP)
inline

Definition at line 167 of file app_var.cpp.

References App_Var< T >::corr_func_binned, Data_Vec< T, N >::dim(), Range::lower, Sim_Param::other_par, Sim_Param::out_opt, Out_Opt::points_per_10_Mpc, Data_Vec< T, N >::reserve(), App_Var< T >::sim, Data_Vec< T, N >::size(), Range::upper, and Other_par::x_corr.

168  {
169  size_t bin_num = (size_t)ceil((APP.sim.other_par.x_corr.upper - APP.sim.other_par.x_corr.lower)/ 10. * APP.sim.out_opt.points_per_10_Mpc);
170  APP.corr_func_binned.reserve(bin_num);
171 
172  return sizeof(FTYPE_t)*APP.corr_func_binned.dim()*APP.corr_func_binned.size();
173  }
size_t size() const noexcept
size_t points_per_10_Mpc
Definition: params.hpp:85
double upper
Definition: params.hpp:163
Data_Vec< double, 2 > corr_func_binned
Definition: app_var.hpp:68
Out_Opt out_opt
Definition: params.hpp:204
Range x_corr
Definition: params.hpp:174
double lower
Definition: params.hpp:163
void reserve(size_t n)
Other_par other_par
Definition: params.hpp:209
const Sim_Param & sim
Definition: app_var.hpp:59
size_t dim() const noexcept
template<class T>
template<class T >
uint64_t App_Var< T >::Impl< T >::alloc_bin_spec ( App_Var< T > &  APP)
inline

Definition at line 157 of file app_var.cpp.

References Out_Opt::bins_per_decade, Sim_Param::box_opt, Data_Vec< T, N >::dim(), Box_Opt::mesh_num_pwr, Sim_Param::out_opt, App_Var< T >::pwr_spec_binned, App_Var< T >::pwr_spec_binned_0, Data_Vec< T, N >::reserve(), App_Var< T >::sim, Data_Vec< T, N >::size(), and App_Var< T >::vel_pwr_spec_binned_0.

158  {
159  size_t bin_num = (size_t)ceil(log10(APP.sim.box_opt.mesh_num_pwr)*APP.sim.out_opt.bins_per_decade);
160  APP.pwr_spec_binned.reserve(bin_num);
161  APP.pwr_spec_binned_0.reserve(bin_num);
162  APP.vel_pwr_spec_binned_0.reserve(bin_num);
163 
164  return sizeof(FTYPE_t)*APP.pwr_spec_binned.dim()*APP.pwr_spec_binned.size()*3;
165  }
Box_Opt box_opt
Definition: params.hpp:202
size_t size() const noexcept
size_t mesh_num_pwr
Definition: params.hpp:58
Data_Vec< double, 2 > vel_pwr_spec_binned_0
Definition: app_var.hpp:68
Data_Vec< double, 2 > pwr_spec_binned
Definition: app_var.hpp:68
Out_Opt out_opt
Definition: params.hpp:204
void reserve(size_t n)
size_t bins_per_decade
Definition: params.hpp:85
Data_Vec< double, 2 > pwr_spec_binned_0
Definition: app_var.hpp:68
const Sim_Param & sim
Definition: app_var.hpp:59
size_t dim() const noexcept
template<class T>
template<class T >
uint64_t App_Var< T >::Impl< T >::alloc_mesh_vec ( App_Var< T > &  APP)
inline

Definition at line 145 of file app_var.cpp.

References App_Var< T >::app_field, Sim_Param::box_opt, Box_Opt::mesh_num, Box_Opt::mesh_num_pwr, App_Var< T >::power_aux, and App_Var< T >::sim.

146  {
147  APP.app_field.reserve(3);
148  APP.power_aux.reserve(3);
149  for(size_t i = 0; i < 3; i++){
150  APP.app_field.emplace_back(APP.sim.box_opt.mesh_num);
151  APP.power_aux.emplace_back(APP.sim.box_opt.mesh_num_pwr);
152  }
153 
154  return sizeof(FTYPE_t)*(APP.app_field[0].length*APP.app_field.size()+APP.power_aux[0].length*APP.power_aux.size());
155  }
Box_Opt box_opt
Definition: params.hpp:202
size_t mesh_num_pwr
Definition: params.hpp:58
std::vector< Mesh > app_field
Definition: app_var.hpp:63
size_t mesh_num
Definition: params.hpp:58
std::vector< Mesh > power_aux
Definition: app_var.hpp:64
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
uint64_t App_Var< T >::Impl< T >::alloc_particles ( App_Var< T > &  APP)
inline

Definition at line 175 of file app_var.cpp.

References Sim_Param::box_opt, Box_Opt::par_num, App_Var< T >::particles, App_Var< T >::sim, and growth_allz::T.

176  {
177  APP.particles.resize(APP.sim.box_opt.par_num); //< use resize instead of reserve for initialization of particles
178  return sizeof(T)*APP.sim.box_opt.par_num;
179  }
size_t par_num
Definition: params.hpp:61
Box_Opt box_opt
Definition: params.hpp:202
std::vector< T > particles
Definition: app_var.hpp:65
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
void App_Var< T >::Impl< T >::create_work_dir ( const Out_Opt out_opt)
inline

Definition at line 296 of file app_var.cpp.

References create_dir(), Out_Opt::print_corr, Out_Opt::print_dens, Out_Opt::print_par_pos, Out_Opt::print_pwr, and Out_Opt::print_vel_pwr.

297  {
298  create_dir(out_dir_app + "log/");
299  if (print_every)
300  {
301  if (out_opt.print_corr) create_dir(out_dir_app + "corr_func/");
302  if (out_opt.print_par_pos) create_dir(out_dir_app + "par_cut/");
303  if (out_opt.print_pwr)
304  {
305  create_dir(out_dir_app + "pwr_diff/");
306  create_dir(out_dir_app + "pwr_spec/");
307  }
308  if (out_opt.print_dens)
309  {
310  create_dir(out_dir_app + "rho_bin/");
311  create_dir(out_dir_app + "rho_map/");
312  }
313 
314  if (out_opt.print_vel_pwr)
315  {
316  create_dir(out_dir_app + "vel_pwr_diff/");
317  create_dir(out_dir_app + "vel_pwr_spec/");
318  }
319  }
320  }
bool print_pwr
Definition: params.hpp:87
bool print_dens
Definition: params.hpp:87
bool print_corr
Definition: params.hpp:87
void create_dir(const std::string &out_dir)
Definition: core_out.cpp:74
unsigned int print_every
Definition: app_var.cpp:341
const std::string out_dir_app
Definition: app_var.cpp:233
bool print_vel_pwr
Definition: params.hpp:87
bool print_par_pos
Definition: params.hpp:87
template<class T>
template<class T >
void App_Var< T >::Impl< T >::fftw_prep ( App_Var< T > &  APP)
inline

Definition at line 181 of file app_var.cpp.

References App_Var< T >::app_field, Sim_Param::box_opt, FFTW_PLAN_C2R, FFTW_PLAN_OMP, FFTW_PLAN_OMP_INIT, FFTW_PLAN_R2C, Box_Opt::mesh_num, Box_Opt::mesh_num_pwr, Run_Opt::nt_fftw, App_Var< T >::p_B, App_Var< T >::p_B_pwr, App_Var< T >::p_F, App_Var< T >::p_F_pwr, App_Var< T >::power_aux, Sim_Param::run_opt, and App_Var< T >::sim.

182  {
183  const Sim_Param& sim = APP.sim; // get rid of 'APP.sim'
184 
185  if (!FFTW_PLAN_OMP_INIT()){
186  throw std::runtime_error("Errors during multi-thread initialization");
187  }
189 
190 
191 
192  const size_t N_pot = sim.box_opt.mesh_num;
193  const size_t N_pwr = sim.box_opt.mesh_num_pwr;
194 
195  APP.p_F = FFTW_PLAN_R2C(N_pot, N_pot, N_pot, APP.app_field[0].real(), APP.app_field[0].complex(), FFTW_ESTIMATE);
196  APP.p_B = FFTW_PLAN_C2R(N_pot, N_pot, N_pot, APP.app_field[0].complex(), APP.app_field[0].real(), FFTW_ESTIMATE);
197  APP.p_F_pwr = FFTW_PLAN_R2C(N_pwr, N_pwr, N_pwr, APP.power_aux[0].real(), APP.power_aux[0].complex(), FFTW_ESTIMATE);
198  APP.p_B_pwr = FFTW_PLAN_C2R(N_pwr, N_pwr, N_pwr, APP.power_aux[0].complex(), APP.power_aux[0].real(), FFTW_ESTIMATE);
199  }
FFTW_PLAN_TYPE p_F_pwr
Definition: app_var.hpp:69
Box_Opt box_opt
Definition: params.hpp:202
: class storing simulation parameters
Definition: params.hpp:193
size_t mesh_num_pwr
Definition: params.hpp:58
size_t nt_fftw
Definition: params.hpp:134
FFTW_PLAN_TYPE p_F
Definition: app_var.hpp:69
#define FFTW_PLAN_C2R
Definition: precision.hpp:30
std::vector< Mesh > app_field
Definition: app_var.hpp:63
#define FFTW_PLAN_OMP
Definition: precision.hpp:31
FFTW_PLAN_TYPE p_B
Definition: app_var.hpp:69
Run_Opt run_opt
Definition: params.hpp:208
#define FFTW_PLAN_OMP_INIT
Definition: precision.hpp:32
size_t mesh_num
Definition: params.hpp:58
FFTW_PLAN_TYPE p_B_pwr
Definition: app_var.hpp:69
std::vector< Mesh > power_aux
Definition: app_var.hpp:64
const Sim_Param & sim
Definition: app_var.hpp:59
#define FFTW_PLAN_R2C
Definition: precision.hpp:29
template<class T>
template<class T >
void App_Var< T >::Impl< T >::get_binned_power_spec ( App_Var< T > &  APP) const
inlineprivate

Definition at line 368 of file app_var.cpp.

References fftw_execute_dft_r2c(), gen_pow_spec_binned(), App_Var< T >::p_F_pwr, App_Var< T >::power_aux, App_Var< T >::pwr_spec_binned, pwr_spec_k(), and App_Var< T >::sim.

369  {/* Compute power spectrum and bin it */
371  pwr_spec_k(APP.power_aux[0], APP.power_aux[0]);
373  }
FFTW_PLAN_TYPE p_F_pwr
Definition: app_var.hpp:69
void fftw_execute_dft_r2c(const FFTW_PLAN_TYPE &p_F, Mesh &rho)
compute forward (real to complex) FFT on mesh (inplace)
Definition: core_mesh.cpp:247
Data_Vec< double, 2 > pwr_spec_binned
Definition: app_var.hpp:68
void gen_pow_spec_binned(const Sim_Param &sim, const Mesh &power_aux, Data_Vec< double, 2 > &pwr_spec_binned)
Definition: core_app.cpp:460
void pwr_spec_k(const Mesh &rho_k, Mesh &power_aux)
Definition: core_app.cpp:324
std::vector< Mesh > power_aux
Definition: app_var.hpp:64
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
bool App_Var< T >::Impl< T >::integrate ( ) const
inlineprivate

Definition at line 431 of file app_var.cpp.

432  {
433  return (a <= a_out) && (da > 0);
434  }
double a_out
Definition: app_var.cpp:323
template<class T>
template<class T >
void App_Var< T >::Impl< T >::integration ( App_Var< T > &  APP)
inline

Definition at line 325 of file app_var.cpp.

References halomod_bm::integrate, App_Var< T >::particles, App_Var< T >::print_output(), App_Var< T >::sim, App_Var< T >::upd_pos(), and z.

326  {
327  print_init(APP); // WARNING: power_aux[0] is modified
328  while(integrate())
329  {
330  BOOST_LOG_TRIVIAL(info) << "Starting computing step with z = " << z() << " (a = " << a << ")";
331  APP.upd_pos();
332  track.update_track_par(APP.particles);
333  if (printing()) APP.print_output();
334  upd_time();
335  }
336  print_info(APP.sim);
337  }
void print_init(App_Var< T > &APP)
Definition: app_var.cpp:419
Tracking track
Definition: app_var.cpp:342
void print_info(const Sim_Param &sim) const
Definition: app_var.cpp:350
bool printing() const
Definition: app_var.cpp:345
void upd_time()
Definition: app_var.cpp:436
std::vector< T > particles
Definition: app_var.hpp:65
bool integrate() const
Definition: app_var.cpp:431
virtual void upd_pos()=0
virtual void print_output()
Definition: app_var.cpp:517
const Sim_Param & sim
Definition: app_var.hpp:59
double z() const
Definition: app_var.cpp:444
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_corr ( App_Var< T > &  APP,
const Extrap_Pk< double, 2 > &  P_k 
) const
inlineprivate

Definition at line 397 of file app_var.cpp.

References App_Var< T >::corr_func_binned, gen_corr_func_binned_gsl_qawf(), gen_corr_func_binned_gsl_qawf_lin(), print_corr_func(), and App_Var< T >::sim.

398  {/* Printing correlation function */
400  print_corr_func(APP.corr_func_binned, out_dir_app, "_gsl_qawf_par" + z_suffix());
402  print_corr_func(APP.corr_func_binned, out_dir_app, "_gsl_qawf_lin" + z_suffix());
403  }
void gen_corr_func_binned_gsl_qawf_lin(const Sim_Param &sim, double a, Data_Vec< double, 2 > &corr_func_binned)
compute linear correlation function and store results
Definition: core_power.cpp:673
void gen_corr_func_binned_gsl_qawf(const Sim_Param &sim, const P &P_k, Data_Vec< double, 2 > &corr_func_binned)
compute correlation function and store results
Definition: core_power.cpp:665
std::string z_suffix() const
Definition: app_var.cpp:247
Data_Vec< double, 2 > corr_func_binned
Definition: app_var.hpp:68
const std::string out_dir_app
Definition: app_var.cpp:233
void print_corr_func(const Data_Vec< double, 2 > &pwr_spec_binned, std::string out_dir, std::string suffix)
Definition: core_out.cpp:174
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_density ( App_Var< T > &  APP) const
inlineprivate

Definition at line 361 of file app_var.cpp.

References App_Var< T >::dens_binned, gen_dens_binned(), App_Var< T >::power_aux, print_dens_bin(), print_rho_map(), and App_Var< T >::sim.

362  {/* Printing density */
363  gen_dens_binned(APP.power_aux[0], APP.dens_binned, APP.sim);
366  }
void print_rho_map(const Mesh &delta, const Sim_Param &sim, std::string out_dir, std::string suffix)
Definition: core_out.cpp:317
void print_dens_bin(const std::vector< size_t > &dens_binned, std::string out_dir, std::string suffix)
Definition: core_out.cpp:402
std::string z_suffix() const
Definition: app_var.cpp:247
std::vector< size_t > dens_binned
Definition: app_var.hpp:70
void gen_dens_binned(const Mesh &rho, std::vector< size_t > &dens_binned, const Sim_Param &sim)
Definition: core_app.cpp:627
const std::string out_dir_app
Definition: app_var.cpp:233
std::vector< Mesh > power_aux
Definition: app_var.hpp:64
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_end ( )
inline

Definition at line 242 of file app_var.cpp.

243  {
244  BOOST_LOG_TRIVIAL(info) << app_long << " ended successfully.";
245  }
const std::string app_long
Definition: app_var.cpp:233
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_extrap_pwr ( App_Var< T > &  APP,
const Extrap_Pk< double, 2 > &  P_k 
) const
inlineprivate

Definition at line 391 of file app_var.cpp.

References gen_pow_spec_binned_from_extrap(), print_pow_spec(), App_Var< T >::pwr_spec_binned, and App_Var< T >::sim.

392  {/* Print extrapolated power spectrum */
394  print_pow_spec(APP.pwr_spec_binned, out_dir_app, "_extrap" + z_suffix());
395  }
void gen_pow_spec_binned_from_extrap(const Sim_Param &sim, const P &P_k, Data_Vec< T, N > &pwr_spec_binned)
Definition: core_app.cpp:478
std::string z_suffix() const
Definition: app_var.cpp:247
void print_pow_spec(const Data_Vec< double, 2 > &pwr_spec_binned, std::string out_dir, std::string suffix)
Definition: core_out.cpp:134
Data_Vec< double, 2 > pwr_spec_binned
Definition: app_var.hpp:68
const std::string out_dir_app
Definition: app_var.cpp:233
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_info ( const Sim_Param sim) const
inlineprivate

Definition at line 350 of file app_var.cpp.

References Sim_Param::print_info().

351  {
353  }
const std::string app_str
Definition: app_var.cpp:233
const std::string out_dir_app
Definition: app_var.cpp:233
void print_info(std::string out, std::string app) const
Definition: params.cpp:497
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_init ( App_Var< T > &  APP)
inlineprivate

Definition at line 419 of file app_var.cpp.

References App_Var< T >::particles, and App_Var< T >::print_output().

420  {
421  /* Setting initial (binned) power spectrum, WARNING: power_aux[0] is modified */
422  track.update_track_par(APP.particles);
423  if (print_every) APP.print_output();
424  upd_time();
425  }
Tracking track
Definition: app_var.cpp:342
void upd_time()
Definition: app_var.cpp:436
std::vector< T > particles
Definition: app_var.hpp:65
unsigned int print_every
Definition: app_var.cpp:341
virtual void print_output()
Definition: app_var.cpp:517
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_input_realisation ( App_Var< T > &  APP)
inline

Definition at line 254 of file app_var.cpp.

References App_Var< T >::app_field, gen_pow_spec_binned_init(), App_Var< T >::power_aux, print_pow_spec(), App_Var< T >::pwr_spec_binned_0, pwr_spec_k_init(), and App_Var< T >::sim.

255  {
256  /* Print input power spectrum (one realisation), before Zel`dovich push */
257  pwr_spec_k_init(APP.app_field[0], APP.power_aux[0]);
258  gen_pow_spec_binned_init(APP.sim, APP.power_aux[0], APP.app_field[0].length/2, APP.pwr_spec_binned_0);
261  }
Interp_obj pwr_spec_input
Definition: app_var.cpp:343
void print_pow_spec(const Data_Vec< double, 2 > &pwr_spec_binned, std::string out_dir, std::string suffix)
Definition: core_out.cpp:134
std::vector< Mesh > app_field
Definition: app_var.hpp:63
void init(const Data_Vec< T, N > &data)
Definition: core_power.cpp:496
const std::string out_dir_app
Definition: app_var.cpp:233
void gen_pow_spec_binned_init(const Sim_Param &sim, const Mesh &power_aux, const size_t half_length, Data_Vec< double, 2 > &pwr_spec_binned)
Definition: core_app.cpp:468
void pwr_spec_k_init(const Mesh &rho_k, Mesh &power_aux)
Definition: core_app.cpp:349
Data_Vec< double, 2 > pwr_spec_binned_0
Definition: app_var.hpp:68
const std::string z_suffix_const
Definition: app_var.cpp:233
std::vector< Mesh > power_aux
Definition: app_var.hpp:64
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_output ( App_Var< T > &  APP)
inline

Definition at line 263 of file app_var.cpp.

References Out_Opt::get_pk_extrap, Out_Opt::get_pwr, Out_Opt::get_rho, get_rho_from_par(), get_vel_from_par(), Sim_Param::out_opt, App_Var< T >::particles, App_Var< T >::power_aux, Out_Opt::print_corr, Out_Opt::print_dens, Out_Opt::print_extrap_pwr, Out_Opt::print_par_pos, Out_Opt::print_pwr, Out_Opt::print_vel_pwr, App_Var< T >::pwr_spec_binned, and App_Var< T >::sim.

264  {
265  const Out_Opt& out_opt = APP.sim.out_opt;
266 
267  /* Printing positions */
268  if (out_opt.print_par_pos) print_position(APP);
269 
270  /* Get discrete density from particles */
271  if (out_opt.get_rho) get_rho_from_par(APP.particles, APP.power_aux[0], APP.sim);
272 
273  /* Printing density */
274  if (out_opt.print_dens) print_density(APP);
275 
276  /* Compute power spectrum and bin it */
277  if (out_opt.get_pwr) get_binned_power_spec(APP);
278 
279  /* Printing power spectrum */
280  if (out_opt.print_pwr) print_power_spec(APP);
281 
282  /* Extrapolate power spectrum beyond range of simulation box */
283  if (out_opt.get_pk_extrap){
284  const Extrap_Pk<FTYPE_t, 2> P_k(APP.pwr_spec_binned, APP.sim);
285  /* Print extrapolated power spectrum */
286  if (out_opt.print_extrap_pwr) print_extrap_pwr(APP, P_k);
287  /* Printing correlation function */
288  if (out_opt.print_corr) print_corr(APP, P_k);
289  }
290 
291  /* Velocity power spectrum */
292  if (out_opt.print_vel_pwr && get_vel_from_par(APP.particles, APP.power_aux, APP.sim)) print_vel_pwr(APP);
293  }
bool print_pwr
Definition: params.hpp:87
bool get_vel_from_par(const std::vector< Particle_v< double >> &particles, std::vector< Mesh > &vel_field, const Sim_Param &sim)
Definition: core_app.cpp:300
void get_rho_from_par(const std::vector< T > &particles, Mesh &rho, const Sim_Param &sim)
Definition: core_app.cpp:278
void print_position(const App_Var< T > &APP) const
Definition: app_var.cpp:355
void print_vel_pwr(App_Var< T > &APP)
Definition: app_var.cpp:405
void print_power_spec(App_Var< T > &APP)
Definition: app_var.cpp:375
bool get_pk_extrap
Definition: params.hpp:89
void print_corr(App_Var< T > &APP, const Extrap_Pk< double, 2 > &P_k) const
Definition: app_var.cpp:397
bool print_dens
Definition: params.hpp:87
Data_Vec< double, 2 > pwr_spec_binned
Definition: app_var.hpp:68
bool print_corr
Definition: params.hpp:87
bool get_pwr
Definition: params.hpp:89
void print_extrap_pwr(App_Var< T > &APP, const Extrap_Pk< double, 2 > &P_k) const
Definition: app_var.cpp:391
Out_Opt out_opt
Definition: params.hpp:204
std::vector< T > particles
Definition: app_var.hpp:65
void get_binned_power_spec(App_Var< T > &APP) const
Definition: app_var.cpp:368
bool get_rho
Definition: params.hpp:89
: linear interpolation of data [k, P(k)] within &#39;useful&#39; range fit to primordial P_i(k) below the &#39;us...
Definition: core_power.h:122
bool print_vel_pwr
Definition: params.hpp:87
bool print_extrap_pwr
Definition: params.hpp:87
output options
Definition: params.hpp:82
std::vector< Mesh > power_aux
Definition: app_var.hpp:64
void print_density(App_Var< T > &APP) const
Definition: app_var.cpp:361
const Sim_Param & sim
Definition: app_var.hpp:59
bool print_par_pos
Definition: params.hpp:87
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_position ( const App_Var< T > &  APP) const
inlineprivate

Definition at line 355 of file app_var.cpp.

References App_Var< T >::particles, print_par_pos_cut_small(), and App_Var< T >::sim.

356  {/* Printing positions */
358  track.print_track_par(APP.sim, out_dir_app, z_suffix());
359  }
Tracking track
Definition: app_var.cpp:342
std::string z_suffix() const
Definition: app_var.cpp:247
std::vector< T > particles
Definition: app_var.hpp:65
const std::string out_dir_app
Definition: app_var.cpp:233
void print_par_pos_cut_small(const std::vector< T > &particles, const Sim_Param &sim, std::string out_dir, std::string suffix)
Definition: core_out.cpp:109
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_power_spec ( App_Var< T > &  APP)
inlineprivate

Definition at line 375 of file app_var.cpp.

References Sim_Param::cosmo, growth_allz::growth_factor, print_pow_spec(), print_pow_spec_diff(), App_Var< T >::pwr_spec_binned, App_Var< T >::pwr_spec_binned_0, and App_Var< T >::sim.

376  {/* Printing power spectrum */
378  if (!is_init_pwr_spec_0){
380  D_init = growth_factor(a, APP.sim.cosmo);
381  is_init_pwr_spec_0 = true;
382  }
383  FTYPE_t D_now = growth_factor(a, APP.sim.cosmo);
387  out_dir_app, "_hybrid" + z_suffix());
388  }
Interp_obj pwr_spec_input
Definition: app_var.cpp:343
std::string z_suffix() const
Definition: app_var.cpp:247
void print_pow_spec(const Data_Vec< double, 2 > &pwr_spec_binned, std::string out_dir, std::string suffix)
Definition: core_out.cpp:134
double D_init
Definition: app_var.cpp:428
bool is_init_pwr_spec_0
Definition: app_var.cpp:429
Data_Vec< double, 2 > pwr_spec_binned
Definition: app_var.hpp:68
Cosmo_Param cosmo
Definition: params.hpp:206
void print_pow_spec_diff(const Data_Vec< double, 2 > &pwr_spec_binned, const Data_Vec< double, 2 > &pwr_spec_binned_0, double growth, std::string out_dir, std::string suffix)
Definition: core_out.cpp:211
const std::string out_dir_app
Definition: app_var.cpp:233
Data_Vec< double, 2 > pwr_spec_binned_0
Definition: app_var.hpp:68
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_sim_name ( ) const
inline

Definition at line 235 of file app_var.cpp.

236  {
237  std::string app_long_upper(app_long);
238  std::transform(app_long_upper.begin(), app_long_upper.end(), app_long_upper.begin(), ::toupper);
239  BOOST_LOG_TRIVIAL(info) << "Starting: " << app_long_upper;
240  }
const std::string app_long
Definition: app_var.cpp:233
template<class T>
template<class T >
void App_Var< T >::Impl< T >::print_vel_pwr ( App_Var< T > &  APP)
inlineprivate

Definition at line 405 of file app_var.cpp.

References Sim_Param::cosmo, fftw_execute_dft_r2c_triple(), gen_pow_spec_binned(), growth_change(), App_Var< T >::p_F_pwr, App_Var< T >::power_aux, print_vel_pow_spec(), print_vel_pow_spec_diff(), App_Var< T >::pwr_spec_binned, App_Var< T >::sim, App_Var< T >::vel_pwr_spec_binned_0, and vel_pwr_spec_k().

406  {/* Print velocity power spectrum */
408  vel_pwr_spec_k(APP.power_aux, APP.power_aux[0]);
413  is_init_vel_pwr_spec_0 = true;
415  }
417  }
void print_vel_pow_spec_diff(const Data_Vec< double, 2 > &pwr_spec_binned, const Data_Vec< double, 2 > &pwr_spec_binned_0, double dDda, std::string out_dir, std::string suffix)
Definition: core_out.cpp:294
bool is_init_vel_pwr_spec_0
Definition: app_var.cpp:429
FFTW_PLAN_TYPE p_F_pwr
Definition: app_var.hpp:69
Data_Vec< double, 2 > vel_pwr_spec_binned_0
Definition: app_var.hpp:68
std::string z_suffix() const
Definition: app_var.cpp:247
double dDda_init
Definition: app_var.cpp:428
void print_vel_pow_spec(const Data_Vec< double, 2 > &pwr_spec_binned, std::string out_dir, std::string suffix)
Definition: core_out.cpp:154
Data_Vec< double, 2 > pwr_spec_binned
Definition: app_var.hpp:68
void gen_pow_spec_binned(const Sim_Param &sim, const Mesh &power_aux, Data_Vec< double, 2 > &pwr_spec_binned)
Definition: core_app.cpp:460
Cosmo_Param cosmo
Definition: params.hpp:206
const std::string out_dir_app
Definition: app_var.cpp:233
void vel_pwr_spec_k(const std::vector< Mesh > &vel_field, Mesh &power_aux)
Definition: core_app.cpp:366
void fftw_execute_dft_r2c_triple(const FFTW_PLAN_TYPE &p_F, std::vector< Mesh > &rho)
compute three forward (real to complex) FFTs on vector of meshes (inplace)
Definition: core_mesh.cpp:258
std::vector< Mesh > power_aux
Definition: app_var.hpp:64
const Sim_Param & sim
Definition: app_var.hpp:59
double growth_change(double a, const Cosmo_Param &cosmo)
Definition: core_power.cpp:447
template<class T>
template<class T >
bool App_Var< T >::Impl< T >::printing ( ) const
inlineprivate

Definition at line 345 of file app_var.cpp.

346  {
347  return print_every ? ((step % print_every) == 0) or (a == a_out) : false ;
348  }
double a_out
Definition: app_var.cpp:323
unsigned int print_every
Definition: app_var.cpp:341
unsigned int step
Definition: app_var.cpp:341
template<class T>
template<class T >
void App_Var< T >::Impl< T >::set_init_cond ( App_Var< T > &  APP)
inline

Definition at line 210 of file app_var.cpp.

References App_Var< T >::app_field, fftw_execute_dft_c2r_triple(), gen_displ_k(), gen_pot_k(), gen_rho_dist_k(), Sim_Param::out_opt, App_Var< T >::p_B, App_Var< T >::p_F, App_Var< T >::power_aux, Out_Opt::print_pwr, and App_Var< T >::sim.

211  {
212  /* Generating the right density distribution in k-space */
213  gen_rho_dist_k(APP.sim, APP.app_field[0], APP.p_F);
214 
215  /* Print input power spectrum (one realisation), before Zel`dovich push */
217 
218  /* Computing initial potential in k-space */
219  gen_pot_k(APP.app_field[0], APP.power_aux[0]);
220 
221  /* Computing displacement in k-space */
222  gen_displ_k(APP.app_field, APP.power_aux[0]);
223 
224  /* Computing displacement in q-space */
225  BOOST_LOG_TRIVIAL(debug) << "Computing displacement in q-space...";
227 
228  /* Set initial positions of particles (with or without velocities) */
229  set_init_pos(APP);
230  }
bool print_pwr
Definition: params.hpp:87
void gen_rho_dist_k(const Sim_Param &sim, Mesh &rho, const FFTW_PLAN_TYPE &p_F)
Generate density distributions in k-space.
Definition: core_app.cpp:267
void gen_displ_k(std::vector< Mesh > &vel_field, const Mesh &pot_k)
Definition: core_app.cpp:623
void fftw_execute_dft_c2r_triple(const FFTW_PLAN_TYPE &p_B, std::vector< Mesh > &rho)
compute three backward (complex to real) FFTs on vector of meshes (inplace)
Definition: core_mesh.cpp:263
FFTW_PLAN_TYPE p_F
Definition: app_var.hpp:69
void gen_pot_k(const Mesh &rho_k, Mesh &pot_k)
Definition: core_app.cpp:496
std::vector< Mesh > app_field
Definition: app_var.hpp:63
Out_Opt out_opt
Definition: params.hpp:204
unsigned int print_every
Definition: app_var.cpp:341
FFTW_PLAN_TYPE p_B
Definition: app_var.hpp:69
void set_init_pos(App_Var< T > &APP)
Definition: app_var.cpp:205
void print_input_realisation(App_Var< T > &APP)
Definition: app_var.cpp:254
std::vector< Mesh > power_aux
Definition: app_var.hpp:64
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
void App_Var< T >::Impl< T >::set_init_pos ( App_Var< T > &  APP)
inline

Definition at line 205 of file app_var.cpp.

References Integ_Opt::a_in, App_Var< T >::app_field, Sim_Param::integ_opt, App_Var< T >::particles, set_pert_pos(), and App_Var< T >::sim.

206  {
207  set_pert_pos(APP.sim, APP.sim.integ_opt.a_in, APP.particles, APP.app_field);
208  }
double a_in
Definition: params.hpp:73
void set_pert_pos(const Sim_Param &sim, const double a, std::vector< Particle_x< double >> &particles, const std::vector< Mesh > &vel_field)
Definition: core_app.cpp:114
std::vector< Mesh > app_field
Definition: app_var.hpp:63
Integ_Opt integ_opt
Definition: params.hpp:203
std::vector< T > particles
Definition: app_var.hpp:65
const Sim_Param & sim
Definition: app_var.hpp:59
template<class T>
template<class T >
void App_Var< T >::Impl< T >::upd_time ( )
inlineprivate

Definition at line 436 of file app_var.cpp.

437  {
438  step++;
439  if ((a_out - a) < da) da = a_out - a;
440  a += da;
441  }
double a_out
Definition: app_var.cpp:323
unsigned int step
Definition: app_var.cpp:341
template<class T>
template<class T >
double App_Var< T >::Impl< T >::z ( ) const
inlineprivate

Definition at line 444 of file app_var.cpp.

445  {
446  return 1/a - 1;
447  }
template<class T>
template<class T >
std::string App_Var< T >::Impl< T >::z_suffix ( ) const
inline

Definition at line 247 of file app_var.cpp.

References z.

248  {
249  std::stringstream z_suffix_num;
250  z_suffix_num << std::fixed << std::setprecision(2) << z();
251  return z_suffix_const + "z" + z_suffix_num.str();
252  }
const std::string z_suffix_const
Definition: app_var.cpp:233
double z() const
Definition: app_var.cpp:444

Member Data Documentation

template<class T>
template<class T >
double App_Var< T >::Impl< T >::a

Definition at line 323 of file app_var.cpp.

template<class T>
template<class T >
double App_Var< T >::Impl< T >::a_out

Definition at line 323 of file app_var.cpp.

template<class T>
template<class T >
const std::string App_Var< T >::Impl< T >::app_long

Definition at line 233 of file app_var.cpp.

template<class T>
template<class T >
const std::string App_Var< T >::Impl< T >::app_str

Definition at line 233 of file app_var.cpp.

template<class T>
template<class T >
double App_Var< T >::Impl< T >::D_init
private

Definition at line 428 of file app_var.cpp.

template<class T>
template<class T >
double App_Var< T >::Impl< T >::da

Definition at line 323 of file app_var.cpp.

template<class T>
template<class T >
double App_Var< T >::Impl< T >::dDda_init
private

Definition at line 428 of file app_var.cpp.

template<class T>
template<class T >
bool App_Var< T >::Impl< T >::is_init_pwr_spec_0
private

Definition at line 429 of file app_var.cpp.

template<class T>
template<class T >
bool App_Var< T >::Impl< T >::is_init_vel_pwr_spec_0
private

Definition at line 429 of file app_var.cpp.

template<class T>
template<class T >
const std::string App_Var< T >::Impl< T >::out_dir_app

Definition at line 233 of file app_var.cpp.

template<class T>
template<class T >
unsigned int App_Var< T >::Impl< T >::print_every
private

Definition at line 341 of file app_var.cpp.

template<class T>
template<class T >
Interp_obj App_Var< T >::Impl< T >::pwr_spec_input
private

Definition at line 343 of file app_var.cpp.

template<class T>
template<class T >
unsigned int App_Var< T >::Impl< T >::step
private

Definition at line 341 of file app_var.cpp.

template<class T>
template<class T >
Tracking App_Var< T >::Impl< T >::track
private

Definition at line 342 of file app_var.cpp.

template<class T>
template<class T >
const std::string App_Var< T >::Impl< T >::z_suffix_const

Definition at line 233 of file app_var.cpp.


The documentation for this class was generated from the following file: