Go to the documentation of this file.
15#define GADGET_VERSION "4.0"
17#define FILEFORMAT_LEGACY1 1
18#define FILEFORMAT_LEGACY2 2
19#define FILEFORMAT_HDF5 3
21#define MODE_LOCAL_PARTICLES 0
22#define MODE_IMPORTED_PARTICLES 1
24#define MODE_LOCAL_NO_EXPORT 3
26#define FIRST_HALF_STEP 0
27#define SECOND_HALF_STEP 1
31#define FLAG_BOUNDARYOVERLAP 2
36#define MAX_THREADS 128
38#ifndef DIRECT_SUMMATION_THRESHOLD
39#define DIRECT_SUMMATION_THRESHOLD 500
42#define NUMBER_OF_MEASUREMENTS_TO_RECORD 6
44#define MAX_FIRST_ELEMENTS_CONSIDERED \
47#define COMMBUFFERSIZE (32 * 1024LL * 1024LL)
49#ifndef MPI_MESSAGE_SIZELIMIT_IN_MB
50#define MPI_MESSAGE_SIZELIMIT_IN_MB 200
53#define MPI_MESSAGE_SIZELIMIT_IN_BYTES ((MPI_MESSAGE_SIZELIMIT_IN_MB)*1024LL * 1024LL)
56#define M_PI 3.14159265358979323846
59#define TO_MBYTE_FAC (1.0 / (1024.0 * 1024.0))
61#ifndef LIGHTCONE_ALLOC_FAC
62#define LIGHTCONE_ALLOC_FAC 0.1
65#ifndef LIGHTCONE_MASSMAP_ALLOC_FAC
66#define LIGHTCONE_MASSMAP_ALLOC_FAC 1.0
69#ifndef LIGHTCONE_MAX_FILLFACTOR
70#define LIGHTCONE_MAX_FILLFACTOR 0.9
73#ifndef ALLOC_TOLERANCE
74#define ALLOC_TOLERANCE 0.2
77#define ALLOC_STARBH_ROOM 0.02
79#define MAX_FLOAT_NUMBER 1e37
80#define MIN_FLOAT_NUMBER 1e-37
81#define MAX_DOUBLE_NUMBER 1e306
82#define MIN_DOUBLE_NUMBER 1e-306
86#if(DOUBLEPRECISION == 2)
87#define MAX_REAL_NUMBER MAX_FLOAT_NUMBER
88#define MIN_REAL_NUMBER MIN_FLOAT_NUMBER
90#define MAX_REAL_NUMBER MAX_DOUBLE_NUMBER
91#define MIN_REAL_NUMBER MIN_DOUBLE_NUMBER
94#define MAX_REAL_NUMBER MAX_FLOAT_NUMBER
95#define MIN_REAL_NUMBER MIN_FLOAT_NUMBER
98#if !defined(GAMMA) && !defined(ISOTHERM_EQS)
99#define GAMMA (5.0 / 3)
104#error "ISOTHERM_EQS overwrites your definition of GAMMA"
110#define GAMMA_MINUS1 (GAMMA - 1)
112#define HYDROGEN_MASSFRAC 0.76
114#define METAL_YIELD 0.02
118#define GRAVITY 6.6738e-8
119#define SOLAR_MASS 1.989e33
120#define BOLTZMANN 1.38065e-16
121#define CLIGHT 2.99792458e10
123#define PARSEC 3.085678e18
124#define PROTONMASS 1.67262178e-24
125#define HUBBLE 3.2407789e-18
127#define SEC_PER_MEGAYEAR 3.15576e13
128#define SEC_PER_YEAR 3.15576e7
130#ifndef FOF_PRIMARY_LINK_TYPES
131#define FOF_PRIMARY_LINK_TYPES 2
134#ifndef FOF_SECONDARY_LINK_TYPES
135#define FOF_SECONDARY_LINK_TYPES 0
138#ifndef FOF_LINKLENGTH
139#define FOF_LINKLENGTH 0.2
142#ifndef FOF_GROUP_MIN_LEN
143#define FOF_GROUP_MIN_LEN 32
146#if defined(PMGRID) && !defined(HRPMGRID)
147#define HRPMGRID PMGRID
150#if !defined(RANDOMIZE_DOMAINCENTER_TYPES) && defined(PLACEHIGHRESREGION)
151#define RANDOMIZE_DOMAINCENTER_TYPES PLACEHIGHRESREGION
154#if defined(SUBFIND) && !defined(SELFGRAVITY)
155#error "Running SUBFIND without SELFGRAVITY enabled does not make sense."
158#if defined(SUBFIND) && !defined(FOF)
159#error "Running SUBFIND without FOF is not possible."
162#if defined(TILING) && !defined(RECREATE_UNIQUE_IDS)
163#error "Running with TILING requires RECREATE_UNIQUE_IDS"
166#if defined(MULTIPOLE_ORDER)
167#if(MULTIPOLE_ORDER < 1) || (MULTIPOLE_ORDER > 5)
168#error "MULTIPOLE_ORDER must be either 1, 2, 3, 4, or 5"
171#define MULTIPOLE_ORDER 1
174#if defined(FORCETEST) && !defined(EVALPOTENTIAL)
175#error "Running with FORCETEST requires EVALPOTENTIAL."
178#if defined(DEBUG_ENABLE_FPU_EXCEPTIONS) && !defined(__linux__)
179#warning "DEBUG_ENABLE_FPU_EXCEPTIONS only works under Linux."
180#undef DEBUG_ENABLE_FPU_EXCEPTIONS
183#if defined(HOST_MEMORY_REPORTING) && !defined(__linux__)
184#warning "HOST_MEMORY_REPORTING only works under Linux."
185#undef HOST_MEMORY_REPORTING
188#if !defined(HOST_MEMORY_REPORTING) && defined(__linux__)
189#define HOST_MEMORY_REPORTING
192#if defined(STARFORMATION) && !defined(COOLING)
193#error "STARFORMATION requires COOLING"
196#if defined(FORCE_EQUAL_TIMESTEPS) && defined(HIERARCHICAL_GRAVITY)
197#error "FORCE_EQUAL_TIMESTEPS cannot be used together with HIERARCHICAL_GRAVITY"
200#if defined(EXTRAPOTTERM) && !defined(EVALPOTENTIAL)
201#error "EXTRAPOTTERM makes only sense for EVALPOTENTIAL"
204#if defined(MERGERTREE) && !defined(SUBFIND)
205#error "MERGERTREE requires SUBFIND."
208#if defined(POWERSPEC_ON_OUTPUT) && !(defined(PERIODIC) && defined(PMGRID))
209#error "The option POWERSPEC_ON_OUTPUT requires PMGRID and PERIODIC."
212#if defined(CREATE_GRID) && !defined(NGENIC)
213#error "CREATE_GRID only makes sense with NGENIC"
216#if defined(OUTPUT_COORDINATES_AS_INTEGERS) && !defined(PERIODIC)
217#error "The OUTPUT_COORDINATES_AS_INTEGERS option is only allowed when PERIODIC is on"
220#if defined(ALLOW_DIRECT_SUMMATION) && !defined(HIERARCHICAL_GRAVITY)
221#error "The option ALLOW_DIRECT_SUMMATION is only availble when HIERARCHICAL_GRAVITY is used"
224#if defined(PMGRID) && !defined(PERIODIC) && !defined(TREEPM_NOTIMESPLIT)
225#error "If PMGRID is used without PERIODIC, TREEPM_NOTIMESPLIT needs to be activated"
228#if defined(PMGRID) && defined(HIERARCHICAL_GRAVITY) && !defined(TREEPM_NOTIMESPLIT)
229#error "If PMGRID is used together with HIERARCHICAL_GRAVITY, you also need to use TREEPM_NOTIMESPLIT"
232#if defined(PLACEHIGHRESREGION) && !defined(RANDOMIZE_DOMAINCENTER)
233#error "PLACEHIGHRESREGION requires RANDOMIZE_DOMAINCENTER."
236#if defined(PLACEHIGHRESREGION) && !defined(PMGRID)
237#error "PLACEHIGHRESREGION requires PMGRID."
240#if defined(TREEPM_NOTIMESPLIT) && !defined(PMGRID)
241#error "The option TREEPM_NOTIMESPLIT requires PMGRID."
244#if defined(HRPMGRID) && !defined(PMGRID)
245#error "It doesn't make sense to set HRPMGRID without having PMGRID."
248#if defined(POSITIONS_IN_64BIT) && defined(POSITIONS_IN_128BIT)
249#error "The options POSITIONS_IN_64BIT and POSITIONS_IN_128BIT should not be activated together."
252#if !defined(EVALPOTENTIAL) && defined(FORCETEST)
253#error "When you enable FORCETEST you should also switch on EVALPOTENTIAL"
256#if(defined(LONG_X_BITS) || defined(LONG_Y_BITS) || defined(LONG_Z_BITS)) && !defined(PERIODIC)
257#error "LONG_X/Y/Z_BITS requires the PERIODIC option"
260#if defined(LIGHTCONE_PARTICLES) && !defined(LIGHTCONE)
261#error "The option LIGHTCONE_PARTICLES requires LIGHTCONE"
264#if defined(LIGHTCONE_MASSMAPS) && !defined(LIGHTCONE)
265#error "The option LIGHTCONE_MASSMAPS requires LIGHTCONE"
268#if defined(LIGHTCONE) && !defined(LIGHTCONE_PARTICLES) && !defined(LIGHTCONE_MASSMAPS)
269#error "The option LIGHTCONE requires selection of at least one of LIGHTCONE_PARTICLES or LIGHTCONE_MASSMAPS"
272#if defined(SUBFIND_HBT) && !defined(MERGERTREE)
273#error "The option SUBFIND_HBT requires MERGERTREE"
276#if defined(LIGHTCONE_PARTICLES) && defined(LIGHTCONE_OUTPUT_ACCELERATIONS) && defined(PMGRID) && \
277 (!defined(TREEPM_NOTIMESPLIT) || defined(HIERARCHICAL_GRAVITY))
278#error "LIGHTCONE_OUTPUT_ACCELERATIONS only works with PMGRID if TREEPM_NOTIMESPLIT is used and HIERARCHICAL_GRAVITY is not used"
281#if defined(EXTERNALGRAVITY_STATICHQ) && !defined(EXTERNALGRAVITY)
282#error "EXTERNALGRAVITY_STATICHQ only works when EXTERNALGRAVITY is activated"
296#ifndef MAXLEN_OUTPUTLIST
297#define MAXLEN_OUTPUTLIST 1100
300#define MAXLEN_PATH 512
301#define MAXLEN_PATH_EXTRA 2048
303#define BASENUMBER 100
312#define NSOFTCLASSES NTYPES
315#ifdef ADAPTIVE_HYDRO_SOFTENING
316#ifndef NSOFTCLASSES_HYDRO
317#define NSOFTCLASSES_HYDRO 64
320#undef NSOFTCLASSES_HYDRO
321#define NSOFTCLASSES_HYDRO 0
324#ifdef ENLARGE_DYNAMIC_RANGE_IN_TIME
328 (((long long)1) << TIMEBINS)
333#define TIMEBASE (1 << TIMEBINS)
336#if(NSOFTCLASSES + NSOFTCLASSES_HYDRO) >= 128
337#error "(NSOFTCLASSES + NSOFTCLASSES_HYDRO) must be smaller than 128"
341#error "NSOFTCLASSES must be at least 1"
346#error "NTYPES may not be larger than 6 if GADGET2_HEADER is set"
354#if defined(STARFORMATION) && (STAR_TYPE >= NTYPES)
355#error "STAR_TYPE must be an available type according to the set NTYPES"
360#define KERNEL_COEFF_1 (4.0 / 3)
361#define KERNEL_COEFF_2 (8.0)
362#define KERNEL_COEFF_3 (24.0)
363#define KERNEL_COEFF_4 (16.0)
364#define KERNEL_COEFF_5 (8.0 / 3)
365#define KERNEL_COEFF_6 (-8.0)
366#define NORM_COEFF 2.0
370#define KERNEL_COEFF_1 2.546479089470
371#define KERNEL_COEFF_2 15.278874536822
372#define KERNEL_COEFF_3 45.836623610466
373#define KERNEL_COEFF_4 30.557749073644
374#define KERNEL_COEFF_5 5.092958178941
375#define KERNEL_COEFF_6 (-15.278874536822)
376#define NORM_COEFF 4.188790204786
379#define KERNEL_COEFF_1 (5.0 / 7 * 2.546479089470)
380#define KERNEL_COEFF_2 (5.0 / 7 * 15.278874536822)
381#define KERNEL_COEFF_3 (5.0 / 7 * 45.836623610466)
382#define KERNEL_COEFF_4 (5.0 / 7 * 30.557749073644)
383#define KERNEL_COEFF_5 (5.0 / 7 * 5.092958178941)
384#define KERNEL_COEFF_6 (5.0 / 7 * (-15.278874536822))
385#define NORM_COEFF M_PI
389#define SOFTFAC1 (32.0 / 3)
391#define SOFTFAC3 (-38.4)
392#define SOFTFAC4 (-2.8)
393#define SOFTFAC5 (16.0 / 3)
395#define SOFTFAC7 (-9.6)
396#define SOFTFAC8 (64.0 / 3)
397#define SOFTFAC9 (-48.0)
398#define SOFTFAC10 38.4
399#define SOFTFAC11 (-32.0 / 3)
400#define SOFTFAC12 (-1.0 / 15)
401#define SOFTFAC13 (-3.2)
402#define SOFTFAC14 (1.0 / 15)
403#define SOFTFAC15 (-16.0)
405#define SOFTFAC17 (-64.0 / 30)
406#define SOFTFAC18 128.0
407#define SOFTFAC19 (-115.2)
408#define SOFTFAC20 (64.0 / 3)
409#define SOFTFAC21 (-96.0)
410#define SOFTFAC22 115.2
411#define SOFTFAC23 (-128.0 / 3)
412#define SOFTFAC24 (4.0 / 30)
414#define SOFTFAC30 (32.0 / 3)
415#define SOFTFAC31 (-576.0 / 5)
416#define SOFTFAC32 (128.0)
417#define SOFTFAC33 (-1152.0 / 5)
418#define SOFTFAC34 (384.0)
419#define SOFTFAC35 (2.0 * 384.0)
421#define SOFTFAC40 (64.0 / 3)
422#define SOFTFAC41 (2.0 / 15)
423#define SOFTFAC42 (-96.0)
424#define SOFTFAC43 (576.0 / 5)
425#define SOFTFAC44 (-128.0 / 3)
426#define SOFTFAC45 (-96.0)
427#define SOFTFAC46 (-2.0 / 5)
428#define SOFTFAC47 (1152.0 / 5)
429#define SOFTFAC48 (-128.0)
430#define SOFTFAC49 (8.0 / 5)
431#define SOFTFAC50 (-256.0)
432#define SOFTFAC51 (-8.0)
434#define SQRT_PI 1.772453850906
435#define FACT1 0.366025403785
436#define FACTSQRT3HALF 0.866025403785
437#define FACTSQRT3 (2.0 * 0.866025403785)