18 const FTYPE_t
ACC = 1e-10;
23 BOOST_LOG_TRIVIAL(debug) <<
"Storing initial expotenital in q-space...";
26 #pragma omp parallel for 27 for (
size_t i = 0; i < expotential.
length; i++) expotential[i] = -potential[i] / (2*nu);
32 FTYPE_t max_exp = *max_element(exp_aux.begin(), exp_aux.end());
34 for(
auto const& a_exp: exp_aux) {
35 if ((a_exp - max_exp) >
log_acc) sum+= exp(a_exp - max_exp);
37 return max_exp + log(sum);
44 const unsigned int N = potential.
N;
45 std::vector<FTYPE_t> exp_aux;
47 #pragma omp parallel for private(exp_aux) 48 for (
int x1 = 0; x1 < N; x1++){
49 for (
int y2 = 0; y2 < N; y2++){
50 for (
int y3 = 0; y3 < N; y3++){
53 for (
int y1 = 0; y1 < N; y1++){
54 exp_aux.push_back(expotential_0(y1, y2, y3)+gaussian[std::abs(x1-y1)]);
66 const unsigned int N = potential.
N;
67 std::vector<FTYPE_t> sum_aux;
68 std::vector<FTYPE_t> exp_aux;
70 #pragma omp parallel for private(sum_aux, exp_aux) 71 for (
int x1 = 0; x1 < N; x1++){
72 for (
int y3 = 0; y3 < N; y3++){
74 for (
int x2 = 0; x2 < N; x2++){
77 for (
int y2 = 0; y2 < N; y2++){
78 exp_aux.push_back(potential(x1, y2, y3) + gaussian[abs(x2-y2)]);
84 for (
int x2 = 0; x2 < N; x2++){
85 potential(x1, x2, y3) = sum_aux[x2];
95 const unsigned int N = potential.
N;
96 std::vector<FTYPE_t> sum_aux;
97 std::vector<FTYPE_t> exp_aux;
99 #pragma omp parallel for private(sum_aux, exp_aux) 100 for (
int x1 = 0; x1 < N; x1++){
101 for (
int x2 = 0; x2 < N; x2++){
103 for (
int x3 = 0; x3 < N; x3++){
106 for (
int y3 = 0; y3 < N; y3++){
107 exp_aux.push_back(potential(x1, x2, y3) + gaussian[abs(x3-y3)]);
112 for (
int x3 = 0; x3 < N; x3++){
113 potential(x1, x2, x3) = sum_aux[x3];
123 BOOST_LOG_TRIVIAL(debug) <<
"Computing expotential in q-space...";
133 std::vector<FTYPE_t> gaussian(expotential_0.
N);
135 #pragma omp parallel for 136 for (
size_t i = 0; i < expotential_0.
N; i++){
137 gaussian[i]=-i*i/(4*b*nu);
162 BOOST_LOG_TRIVIAL(debug) <<
"Computing potential...";
166 BOOST_LOG_TRIVIAL(debug) <<
"Computing velocity field via FFT...";
194 m_impl->aa_convolution(*
this);
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)
class handling particles (position only)
void kick_step_w_momentum(const Cosmo_Param &cosmo, const double a, const double da, std::vector< Particle_v< double >> &particles, const std::vector< Mesh > &force_field)
AAImpl(const Sim_Param &sim)
void gen_displ_k(std::vector< Mesh > &vel_field, const Mesh &pot_k)
: class storing simulation parameters
void fftw_execute_dft_r2c(const FFTW_PLAN_TYPE &p_F, Mesh &rho)
compute forward (real to complex) FFT on mesh (inplace)
: creates a mesh of N*N*(N+2) 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)
ahesion approximation interface
void gen_expot(Mesh &potential, const Mesh &expotential_0, double nu, double b)
functions for integration of particle trajectories
void fftw_execute_dft_c2r(const FFTW_PLAN_TYPE &p_B, Mesh &rho)
compute backward (complex to real) FFT on mesh (inplace)
std::vector< Mesh > app_field
void pot_corr(std::vector< Mesh > &vel_field, Mesh &pot_k) override
interface for common functions for all types of approximations
: class containing variables and methods for adhesion approximation
void aa_convolution(App_Var_AA &APP)
various simulation parameters
std::vector< Particle_v< double > > particles
void convolution_y2(Mesh &potential, const std::vector< double > &gaussian)
const std::unique_ptr< AAImpl > m_impl
basic functions to work with mesh
App_Var_AA(const Sim_Param &sim)
void convolution_y1(Mesh &potential, const std::vector< double > &gaussian, const Mesh &expotential_0)
void gen_init_expot(const Mesh &potential, Mesh &expotential, double nu)
void convolution_y3(Mesh &potential, const std::vector< double > &gaussian)
double get_summation(const std::vector< double > &exp_aux)