12#include "gadgetconfig.h"
19#include "../data/allvars.h"
20#include "../data/dtypes.h"
21#include "../data/intposconvert.h"
22#include "../data/mymalloc.h"
23#include "../gravtree/gravtree.h"
25#include "../main/simulation.h"
26#include "../system/system.h"
27#include "../time_integration/driftfac.h"
29#ifdef SECOND_ORDER_LPT_ICS
31double sim::F1_Omega(
double a)
35 return pow(omega_a, 5.0 / 9);
38double sim::F2_Omega(
double a)
42 return 2.0 *
pow(omega_a, 6.0 / 11);
45void sim::second_order_ic_correction(
void)
50 mpi_printf(
"SECOND_ORDER_LPT_ICS: Now producing ICs based on 2nd-order LPT\n");
56 double *mass_bak = (
double *)
Mem.mymalloc(
"mass_bak",
Sp.
NumPart *
sizeof(
double));
66#if defined(PMGRID) && defined(PERIODIC) && !defined(TREEPM_NOTIMESPLIT)
80 double fac1 = 1.0 / (a * a * hubble * F1_Omega(a));
82 double fac2 =
All.LptScalingfactor;
84 double fac3 = fac2 * a * a * hubble * F2_Omega(a);
86 mpi_printf(
"SECOND_ORDER_LPT_ICS: fac1=%g fac2=%g fac3=%g\n", fac1, fac2, fac3);
91 for(
int j = 0; j < 3; j++)
92 posdiff[j] = fac1 * P[i].Vel[j];
97 for(
int j = 0; j < 3; j++)
98 P[i].IntPos[j] += delta[j];
101#if defined(PMGRID) && defined(PERIODIC) && !defined(TREEPM_NOTIMESPLIT)
102 for(
int j = 0; j < 3; j++)
103 acc[j] = P[i].GravPM[j] + P[i].GravAccel[j];
105 for(
int j = 0; j < 3; j++)
106 acc[j] = P[i].GravAccel[j];
109 for(
int j = 0; j < 3; j++)
110 posdiff[j] = fac2 * acc[j];
114 for(
int j = 0; j < 3; j++)
115 P[i].IntPos[j] += delta[j];
117 for(
int j = 0; j < 3; j++)
118 P[i].Vel[j] += fac3 * acc[j];
129 Mem.myfree(mass_bak);
131 mpi_printf(
"SECOND_ORDER_LPT_ICS: finished,\n");
global_data_all_processes All
static double hubble_function(double a)
MySignedIntPosType pos_to_signedintpos(T posdiff)
void mpi_printf(const char *fmt,...)
domain< simparticles > Domain
void gravity(int timebin)
main driver routine of gravity tree/fmm force calculation
void gravity_long_range_force(void)
void treeallocate(int max_partindex, partset *Pptr, domain< partset > *Dptr)
int treebuild(int ninsert, int *indexlist)
int32_t MySignedIntPosType
expr pow(half base, half exp)
int TypeOfOpeningCriterion
char RelOpeningCriterionInUse
void setMass(MyDouble mass)