Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
test_mod_frozen_potential.cpp
Go to the documentation of this file.
1
#include <
catch.hpp
>
2
#include "../test.hpp"
3
#include "
mod_frozen_potential.cpp
"
4
5
// void force_test(Sim_Param& sim)
6
// {
7
// // 1 particle prep
8
// BOOST_LOG_TRIVIAL(info) << "Adjust simulation parameters to 1 particle.\n";
9
// sim.par_num = 1;
10
// sim.mesh_num_pwr = sim.mesh_num;
11
// sim.Ng = sim.Ng_pwr = sim.mesh_num / pow(sim.par_num, 1/3.);
12
// sim.print_info();
13
// App_Var_FP_mod APP(sim, "test_pp");
14
// APP.print_mem();
15
16
// BOOST_LOG_TRIVIAL(info) << "Place particle in the middle of the box.\n";
17
// APP.particles[0] = Particle_v<FTYPE_t>(sim.mesh_num/2, sim.mesh_num/2., sim.mesh_num/2., 0, 0, 0); // middle, no velocity
18
// get_rho_from_par(APP.particles, &APP.app_field[0], sim); // assign density
19
// BOOST_LOG_TRIVIAL(debug) << "Transforming density into k-sapce...\n");
20
// fftw_execute_dft_r2c(APP.p_F_pwr, APP.app_field[0]); // get \rho(k)
21
// gen_pot_k(APP.app_field[0], &APP.power_aux[0]); // get \phi(k)
22
// gen_displ_k_S2(&APP.app_field, APP.power_aux[0], APP.sim.a);
23
// BOOST_LOG_TRIVIAL(debug) << "Computing force in q-space...\n");
24
// fftw_execute_dft_c2r_triple(APP.p_B, APP.app_field);
25
26
// BOOST_LOG_TRIVIAL(debug) << "Creating linked list...\n");
27
// APP.linked_list.get_linked_list(APP.particles);
28
29
// for (size_t i = 0; i <sim.par_num; i++)
30
// {
31
// BOOST_LOG_TRIVIAL(info) << "LL[" << i << "] = " << APP.linked_list.LL[i];
32
// }
33
// for (size_t i = 0; i < APP.linked_list.HOC.length; i++){
34
// if (APP.linked_list.HOC[i] != -1){
35
// BOOST_LOG_TRIVIAL(info) << "HOC [" << i << "] = " << APP.linked_list.HOC[i]
36
// << "\tChain position = "
37
// << i / (APP.linked_list.HOC.N2*APP.linked_list.HOC.N3) << " "
38
// << (i / APP.linked_list.HOC.N3) % APP.linked_list.HOC.N2 << " "
39
// << i % APP.linked_list.HOC.N3 << "\n";
40
// }
41
// }
42
43
// Vec_3D<FTYPE_t> f_long, f_short, f_total, dr_vec, cur_pos;
44
// FTYPE_t dr;
45
// FTYPE_t m = pow(sim.Ng, 3);
46
47
// // BOOST_LOG_TRIVIAL(info) << "\n\nr_vec\t\tr\t|\tshort\t\t\t\tlong\t\t\t\ttotal\t\t\t|\ts\tl\tt\tm/4PIr2\n";
48
// string file_name = "/home/vrastil/Documents/GIT/Adhesion-Approximation/output/test_runs/test_pp_run/data_rs_" + to_string(sim.rs) + ".dat";
49
// ofstream File(file_name);
50
// File << "#r\ts\tl\tt\tm/4PIr2\n";
51
// File << setprecision(8);
52
// FTYPE_t inc = sim.rs/3.;
53
// for (FTYPE_t i = 5; i < sim.mesh_num-5; i += inc)
54
// {
55
// f_long.fill(0.);
56
// f_short.fill(0.);
57
// cur_pos = Vec_3D<FTYPE_t>(i, i, i);
58
// dr_vec = get_sgn_distance(APP.particles[0].position, cur_pos, sim.mesh_num);
59
// dr = dr_vec.norm();
60
// if (dr > 5*sim.rs) inc = sim.rs/3.;
61
// else if (dr > sim.rs) inc = sim.rs/10.;
62
// else inc = sim.rs/40.;
63
64
// assign_from(APP.app_field, cur_pos, &f_long);
65
// force_short(sim, 1, APP.linked_list, APP.particles, cur_pos, &f_short);
66
// f_total = f_short + f_long;
67
68
// if (dr != 0){
69
// File << scientific;
70
// //File << dr_vec[0] << ", ...\t";
71
// //File << dr << "\t|\t";
72
// File << dr << "\t";
73
// // File << f_short[0] << " " << f_short[1] << " " << f_short[2] << "\t\t";
74
// // File << f_long[0] << " " << f_long[1] << " " << f_long[2] << "\t\t";
75
// // File << f_total[0] << " " << f_total[1] << " " << f_total[2] << "\t|\t";
76
// File << f_short.norm() << "\t" << f_long.norm() << "\t" << f_total.norm() << "\t";
77
// File << m/(4*PI*dr*dr) << "\n";
78
// }
79
// }
80
// File.close();
81
// }
catch.hpp
mod_frozen_potential.cpp
modified frozen-potential approximation implementation
src
ApproximationsSchemes
tests
test_mod_frozen_potential.cpp
Generated by
1.8.11