GADGET-4
allvars.h
Go to the documentation of this file.
1/*******************************************************************************
2 * \copyright This file is part of the GADGET4 N-body/SPH code developed
3 * \copyright by Volker Springel. Copyright (C) 2014-2020 by Volker Springel
4 * \copyright (vspringel@mpa-garching.mpg.de) and all contributing authors.
5 *******************************************************************************/
14#ifndef ALLVARS_H
15#define ALLVARS_H
16
17#include "gadgetconfig.h"
18
19#include <math.h>
20
21#include "../data/constants.h"
22#include "../data/dtypes.h"
23#include "../data/macros.h"
24#include "../io/parameters.h"
25
33{
34#if defined(COOLING)
35 char TreecoolFile[255];
36#endif
37
38#ifdef INDIVIDUAL_GRAVITY_SOFTENING
39 double AvgType1Mass;
40#endif
41
43
65
67
74 /* some SPH parameters */
75
78#ifdef LEAN
79 MyDouble PartMass;
80#endif
81
82#ifdef TIMEDEP_ART_VISC
83 double AlphaMin;
84#endif
85
86#ifdef SUBFIND
87 int DesLinkNgb;
88#endif
89
92
96 double InitGasTemp;
97 double InitGasU;
98 double MinEgySpec;
101 /* some force counters */
102
103 long long TotNumOfForces;
105 long long TotNumDensity;
106 long long TotNumHydro;
108 /* various cosmological factors that are only a function of the current scale factor, and in non-comoving runs are set to 1 */
111 /* Hubble rate at the current time, valid both for comoving and non-comoving intergation */
112 double cf_H;
113
114 double accel_normalize_fac; /* used in I/O to normalize accelerations if reduced precision storage is used */
115
116 /* system of units */
132 double G;
134 /* Cosmology */
135
136 double Hubble;
137 double Omega0;
138 double OmegaLambda;
139 double OmegaBaryon;
140 double HubbleParam;
144 double BoxSize;
146 /* Code options */
147
162 /* parameters determining output frequency */
163
164#if defined(TREEPM_NOTIMESPLIT) || defined(PLACEHIGHRESREGION)
165 double ActivePartFracForPMinsteadOfEwald;
166#endif
167
177 /* Current time of the simulation, global step, and end of simulation */
178
179 double Time;
180 double TimeBegin;
181 double TimeStep;
182 double TimeMax;
183 double TimeOld;
185 /* variables for organizing discrete timeline */
186
191
192#if defined(PMGRID) && !defined(TREEPM_NOTIMESPLIT)
193 integertime PM_Ti_endstep, PM_Ti_begstep;
194#endif
195
196#if defined(EVALPOTENTIAL) && defined(PMGRID) && defined(PERIODIC)
197 double TotalMass;
198#endif
199
201 {
203 return TimeBegin * exp(ti * Timebase_interval);
204 else
205 return TimeBegin + ti * Timebase_interval;
206 }
207
209
212#ifdef FORCE_EQUAL_TIMESTEPS
213 integertime GlobalTimeStep;
214#endif
215
216 /* variables that keep track of CPU consumption */
217
219
221
222 /* tree code opening criterion */
223
224 double ErrTolTheta;
230 /* adjusts accuracy of time-integration */
231
239 double CourantFac;
243
244 /* gravitational and hydrodynamical softening lengths (given in terms of an `equivalent' Plummer softening
245 * length)
246 *
247 * five groups of particles are supported 0=gas,1=halo,2=disk,3=bulge,4=stars
248 */
249
251
258 2];
260#ifdef ADAPTIVE_HYDRO_SOFTENING
261 double MinimumComovingHydroSoftening;
262 double AdaptiveHydroSofteningSpacing;
263 double GasSoftFactor;
264#endif
265
270
271 /* some filenames */
273
279#ifdef SECOND_ORDER_LPT_ICS
280 double LptScalingfactor;
281#endif
282
283#if defined(PMGRID) && !defined(TREEPM_NOTIMESPLIT)
284 double DtDisplacement;
285#endif
286
287#ifdef LIGHTCONE
288
289#ifdef LIGHTCONE_PARTICLES
290 char LightConeDefinitionFile[MAXLEN_PATH];
291 int LightconeFileCount;
292#endif
293
294#ifdef LIGHTCONE_MASSMAPS
295 int LightConeMassMapsNside;
296 double LightConeMassMapThickness;
297 double LightConeMassMapMaxRedshift;
298 int CurrentMassMapBoundary;
299#endif
300
301 int LightConeImageConeNr;
302 double LightConeImageLengthX;
303 double LightConeImageLengthY;
304 double LightConeImageCornerX;
305 double LightConeImageCornerY;
306 int LightConeImagePixelsX;
307 int LightConeImagePixelsY;
308 char LightConeImagePicName[MAXLEN_PATH];
309 int LightConeImageFirstConeDir;
310 int LightConeImageLastConeDir;
311#endif
312
313#ifdef STARFORMATION /* star formation and feedback sector */
314 double CritOverDensity;
315 double CritPhysDensity;
316 double OverDensThresh;
317 double PhysDensThresh;
318 double EgySpecSN;
319 double EgySpecCold;
320 double FactorEVP;
321 double TempSupernova;
322 double TempClouds;
323 double MaxSfrTimescale;
324 double FactorSN;
325 MyIDType MaxID;
326#endif
327
328#ifdef REDUCE_FLUSH
329 double FlushCpuTimeDiff;
330 double FlushLast;
331#endif
332
333#ifdef NGENIC
334 int NSample;
335 int SphereMode;
336 int PowerSpectrumType;
337 int ReNormalizeInputSpectrum;
338 double PrimordialIndex;
339 double ShapeGamma;
340 double Sigma8;
341 char PowerSpectrumFile[MAXLEN_PATH];
342 double InputSpectrum_UnitLength_in_cm;
343 int NgenicSeed;
344#endif
345
346#ifdef CREATE_GRID
347 int GridSize;
348#endif
349
350#ifdef EXTERNALGRAVITY_STATICHQ
351 double A_StaticHQHalo;
352 double Mass_StaticHQHalo;
353#endif
354
356 void register_parameters(void);
357 void read_outputlist(char *fname);
358 void some_parameter_checks(void);
359
360 inline char *get_data_ptr(void) { return (char *)this + sizeof(parameters); }
361
362 inline size_t get_data_size(void) { return sizeof(global_data_all_processes) - sizeof(parameters); }
363};
364
366
367#endif
global_data_all_processes All
Definition: main.cc:40
#define MAXLEN_OUTPUTLIST
Definition: constants.h:297
#define NUMBER_OF_MEASUREMENTS_TO_RECORD
Definition: constants.h:42
#define TIMEBINS
Definition: constants.h:332
#define NSOFTCLASSES_HYDRO
Definition: constants.h:321
#define NSOFTCLASSES
Definition: constants.h:312
#define NTYPES
Definition: constants.h:308
int integertime
Definition: constants.h:331
#define MAXLEN_PATH
Definition: constants.h:300
float MyDouble
Definition: dtypes.h:87
restart_options
Definition: dtypes.h:312
unsigned int MyIDType
Definition: dtypes.h:68
expr exp(half arg)
Definition: half.hpp:2724
double get_absolutetime_from_integertime(integertime ti)
Definition: allvars.h:200
long long GlobalNSynchronizedHydro
Definition: allvars.h:90
long long GlobalNSynchronizedGravity
Definition: allvars.h:91
int SofteningClassOfPartType[NTYPES]
Definition: allvars.h:250
double UnitVelocity_in_cm_per_s
Definition: allvars.h:119
double CPU_TimeBinMeasurements[TIMEBINS][NUMBER_OF_MEASUREMENTS_TO_RECORD]
Definition: allvars.h:242
enum restart_options RestartFlag
Definition: allvars.h:68
void read_outputlist(char *fname)
This function reads a table with a list of desired output times.
Definition: allvars.cc:211
int CPU_TimeBinCountMeasurements[TIMEBINS]
Definition: allvars.h:241
double ForeignNodeAllocFactor
Definition: allvars.h:64
double MassTable[NTYPES]
Definition: allvars.h:269
double SofteningMaxPhys[NSOFTCLASSES]
Definition: allvars.h:253
void register_parameters(void)
Definition: allvars.cc:55
double ForeignPointAllocFactor
Definition: allvars.h:66
integertime Ti_Current
Definition: allvars.h:188
integertime Ti_begstep[TIMEBINS]
Definition: allvars.h:210
char OutputListFilename[MAXLEN_PATH]
Definition: allvars.h:272
int SmallestTimeBinWithDomainDecomposition
Definition: allvars.h:160
long long TotNumDirectForces
Definition: allvars.h:104
char OutputDir[MAXLEN_PATH]
Definition: allvars.h:272
integertime Ti_lastoutput
Definition: allvars.h:190
integertime Ti_nextoutput
Definition: allvars.h:189
double SofteningComoving[NSOFTCLASSES]
Definition: allvars.h:252
double ForceSoftening[NSOFTCLASSES+NSOFTCLASSES_HYDRO+2]
Definition: allvars.h:258
void some_parameter_checks(void)
Definition: allvars.cc:255
double OutputListTimes[MAXLEN_OUTPUTLIST]
Definition: allvars.h:275
char SnapshotFileBase[MAXLEN_PATH]
Definition: allvars.h:272
double GravityConstantInternal
Definition: allvars.h:128
void set_cosmo_factors_for_current_time(void)
Definition: allvars.cc:20
long long TotNumOfForces
Definition: allvars.h:103
double ActivePartFracForNewDomainDecomp
Definition: allvars.h:161
size_t get_data_size(void)
Definition: allvars.h:362
char OutputListFlag[MAXLEN_OUTPUTLIST]
Definition: allvars.h:276
char * get_data_ptr(void)
Definition: allvars.h:360
char InitCondFile[MAXLEN_PATH]
Definition: allvars.h:272
double SofteningTable[NSOFTCLASSES+NSOFTCLASSES_HYDRO]
Definition: allvars.h:256