26 par_num(par_num), Hc(hc), LL(par_num), HOC(m, m, m) {}
31 std::vector<size_t>
LL;
38 for (
size_t i = 0; i < par_num; i++)
40 LL[i] = HOC(particles[i].position/Hc);
41 HOC(particles[i].position/Hc) = i;
46 FTYPE_t
force_ref(
const FTYPE_t r,
const FTYPE_t a){
48 FTYPE_t
z = 2 * r / a;
49 if (z > 2)
return 1 / (r*r);
50 else if (z > 1)
return (12 / (z*z) - 224 + 896 * z - 840 * z*z + 224 *
pow(z, 3) +
51 70 *
pow(z, 4) - 48 *
pow(z, 5) + 7 *
pow(z, 6)) / (35 * a*a);
52 else return (224 * z - 224 *
pow(z, 3) + 70 *
pow(z, 4) + 48 *
pow(z, 5) - 21 *
pow(z, 7)) / (35 * a*a);
55 FTYPE_t
force_tot(
const FTYPE_t r,
const FTYPE_t e2){
62 #define FORCE_SHORT_NO_INTER 74 p = linked_list.
HOC(it.
vec);
78 if ((dr2 < rs2) && (dr2 != 0))
80 #ifdef FORCE_SHORT_NO_INTER 84 force += dr_vec*(m/
sqrt(dr2)*fs_interp.eval(dr2));
87 p = linked_list.
LL[
p];
95 const size_t Np = particles.size();
101 const FTYPE_t f1 = 3/(2*a)*(Om+2*OL)/(Om+OL);
102 const FTYPE_t f2 = 3/(2*a)*Om/(Om+OL)*D/a;
104 BOOST_LOG_TRIVIAL(debug) <<
"Creating linked list...";
107 BOOST_LOG_TRIVIAL(debug) <<
"Computing short and long range parts of the potential...";
108 #pragma omp parallel for private(force) 109 for (
size_t i = 0; i < Np; i++)
112 assign_from(force_field, particles[i].position, force);
113 force_short(sim, D, linked_list, particles, particles[i].position, force, fs_interp);
115 force = force*f2 - particles[i].velocity*f1;
116 particles[i].velocity += force*da;
132 memory_alloc =
sizeof(size_t)*(linked_list.HOC.length+linked_list.par_num);
135 size_t res = size_t(sim.
app_opt.
rs/0.05)+1;
136 const FTYPE_t r0 = sim.
app_opt.
rs / (res-1);
141 #pragma omp parallel for private(r) 142 for(
size_t i = 0; i < res; i++)
145 data[0][i] =
pow2(r);
148 fs_interp.init(data);
172 BOOST_LOG_TRIVIAL(debug) <<
"Computing force in q-space...";
const std::unique_ptr< FP_ppImpl > m_impl
class containing core variables and methods for approximations
void stream_kick_stream(const double da, std::vector< Particle_v< double >> &particles, std::function< void()> kick_step, size_t per)
: linear interpolation (Steffen) of data [x, y]
class handling particles (position only)
Vec_3D< double > get_sgn_distance(const Vec_3D< double > &x_from, const Vec_3D< double > &x_to, size_t per)
: class storing simulation parameters
: creates a mesh of N*N*(N+2) cells
: class for effective iteration of cube of mesh cells
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)
modified frozen-potential approximation interface
class handling linked lists
functions for integration of particle trajectories
void kick_step_w_pp(const Sim_Param &sim, const double a, const double da, std::vector< Particle_v< double >> &particles, const std::vector< Mesh > &force_field, LinkedList &linked_list, Interp_obj &fs_interp)
double force_tot(const double r, const double e2)
std::vector< Mesh > app_field
declaration in params.hpp
void pot_corr(std::vector< Mesh > &vel_field, Mesh &pot_k) override
Grid< NDIM, T > sqrt(Grid< NDIM, T > lhs)
interface for common functions for all types of approximations
various simulation parameters
std::vector< Particle_v< double > > particles
void force_short(const Sim_Param &sim, const double D, const LinkedList &linked_list, const std::vector< Particle_v< double >> &particles, const Vec_3D< double > &position, Vec_3D< double > &force, Interp_obj &fs_interp)
LinkedList(size_t par_num, size_t m, double hc)
void get_linked_list(const std::vector< Particle_v< double >> &particles)
basic functions to work with mesh
FP_ppImpl(const Sim_Param &sim)
float pow(float base, unsigned long int exp)
App_Var_FP_mod(const Sim_Param &sim)
double force_ref(const double r, const double a)
void assign_from(const Mesh &field, const Vec_3D< double > &position, double &value, double mod)
void gen_displ_k_S2(std::vector< Mesh > &vel_field, const Mesh &pot_k, const double a)