MP-Gadget  5.0.1.dev1-76bc7d4726-dirty
Functions
params.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <libgadget/gravity.h>
#include <libgadget/densitykernel.h>
#include <libgadget/timebinmgr.h>
#include <libgadget/timestep.h>
#include <libgadget/utils.h>
#include <libgadget/treewalk.h>
#include <libgadget/cooling_rates.h>
#include <libgadget/winds.h>
#include <libgadget/sfr_eff.h>
#include <libgadget/blackhole.h>
#include <libgadget/density.h>
#include <libgadget/hydra.h>
#include <libgadget/fof.h>
#include <libgadget/init.h>
#include <libgadget/run.h>
#include <libgadget/petaio.h>
#include <libgadget/cooling_qso_lightup.h>
#include <libgadget/metal_return.h>
#include <libgadget/stats.h>
Include dependency graph for params.c:

Go to the source code of this file.

Functions

static int BlackHoleFeedbackMethodAction (ParameterSet *ps, const char *name, void *data)
 
static int StarformationCriterionAction (ParameterSet *ps, const char *name, void *data)
 
static ParameterSetcreate_gadget_parameter_set ()
 
void read_parameter_file (char *fname, int *ShowBacktrace, double *MaxMemSizePerNode)
 

Function Documentation

◆ BlackHoleFeedbackMethodAction()

static int BlackHoleFeedbackMethodAction ( ParameterSet ps,
const char *  name,
void *  data 
)
static

Definition at line 28 of file params.c.

29 {
30  int v = param_get_enum(ps, name);
32  message(1, "error BlackHoleFeedbackMethod contains either tophat or spline, but both\n");
33  return 1;
34  }
36  message(1, "error BlackHoleFeedbackMethod contains either volume or mass, but both\n");
37  return 1;
38  }
39  return 0;
40 }
@ BH_FEEDBACK_MASS
Definition: blackhole.h:11
@ BH_FEEDBACK_SPLINE
Definition: blackhole.h:10
@ BH_FEEDBACK_VOLUME
Definition: blackhole.h:12
@ BH_FEEDBACK_TOPHAT
Definition: blackhole.h:9
const char * name
Definition: densitykernel.c:93
void message(int where, const char *fmt,...)
Definition: endrun.c:175
int param_get_enum(ParameterSet *ps, const char *name)
Definition: paramset.c:378
#define HAS(val, flag)
Definition: types.h:22

References BH_FEEDBACK_MASS, BH_FEEDBACK_SPLINE, BH_FEEDBACK_TOPHAT, BH_FEEDBACK_VOLUME, HAS, message(), name, and param_get_enum().

Referenced by create_gadget_parameter_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_gadget_parameter_set()

static ParameterSet* create_gadget_parameter_set ( )
static

Definition at line 54 of file params.c.

55 {
57 
58  param_declare_string(ps, "InitCondFile", REQUIRED, NULL, "Path to the Initial Condition File");
59  param_declare_string(ps, "OutputDir", REQUIRED, NULL, "Prefix to the output files");
60 
61  static ParameterEnum DensityKernelTypeEnum [] = {
62  {"cubic", DENSITY_KERNEL_CUBIC_SPLINE},
63  {"quintic", DENSITY_KERNEL_QUINTIC_SPLINE},
64  {"quartic", DENSITY_KERNEL_QUARTIC_SPLINE},
66  } ;
67  param_declare_enum(ps, "DensityKernelType", DensityKernelTypeEnum, OPTIONAL, "quintic", "SPH density kernel to use. Supported values are cubic, quartic and quintic.");
68  param_declare_string(ps, "SnapshotFileBase", OPTIONAL, "PART", "Base name of the snapshot files, _%03d will be appended to the name.");
69  param_declare_string(ps, "FOFFileBase", OPTIONAL, "PIG", "Base name of the fof files, _%03d will be appended to the name.");
70  param_declare_string(ps, "EnergyFile", OPTIONAL, "energy.txt", "File to output energy statistics.");
71  param_declare_int(ps, "OutputEnergyDebug", OPTIONAL, 0, "Should we output energy statistics to energy.txt");
72  param_declare_string(ps, "CpuFile", OPTIONAL, "cpu.txt", "File to output cpu usage information");
73  param_declare_string(ps, "OutputList", REQUIRED, NULL, "List of output scale factors.");
74 
75  /*Cosmology parameters*/
76  param_declare_double(ps, "Omega0", REQUIRED, 0.2814, "Total matter density at z=0");
77  param_declare_double(ps, "CMBTemperature", OPTIONAL, 2.7255,
78  "Present-day CMB temperature in Kelvin, default from Fixsen 2009; affects background if RadiationOn is set.");
79  param_declare_double(ps, "OmegaBaryon", OPTIONAL, -1, "Baryon density at z=0");
80  param_declare_double(ps, "OmegaLambda", OPTIONAL, -1, "Dark energy density at z=0");
81  param_declare_double(ps, "Omega_fld", OPTIONAL, 0, "Energy density of dark energy fluid.");
82  param_declare_double(ps, "w0_fld", OPTIONAL, -1., "Dark energy equation of state.");
83  param_declare_double(ps, "wa_fld", OPTIONAL, 0, "Dark energy evolution parameter.");
84  param_declare_double(ps, "Omega_ur", OPTIONAL, 0, "Extra radiation density, eg, a sterile neutrino");
85  param_declare_double(ps, "HubbleParam", OPTIONAL, -1, "Hubble parameter. Does not affect gravity. Used only for cooling and star formation.");
86  /*End cosmology parameters*/
87 
88  param_declare_int(ps, "OutputPotential", OPTIONAL, 1, "Save the potential in snapshots.");
89  param_declare_int(ps, "OutputTimebins", OPTIONAL, 0, "Save the particle timebins in snapshots, for debugging.");
90  param_declare_int(ps, "OutputHeliumFractions", OPTIONAL, 0, "Save the helium ionic fractions in snapshots.");
91  param_declare_int(ps, "OutputDebugFields", OPTIONAL, 0, "Save a large number of debug fields in snapshots.");
92  param_declare_int(ps, "ShowBacktrace", OPTIONAL, 1, "Print a backtrace on crash. Hangs on stampede.");
93  param_declare_double(ps, "MaxMemSizePerNode", OPTIONAL, 0.6, "Pre-allocate this much memory per computing node/ host, in MB. Passing < 1 allocates a fraction of total available memory per node, defaults to 0.6 available memory.");
94  param_declare_double(ps, "AutoSnapshotTime", OPTIONAL, 0, "Seconds after which to automatically generate a snapshot if nothing is output.");
95 
96  param_declare_double(ps, "TimeMax", OPTIONAL, 1.0, "Scale factor to end run.");
97  param_declare_double(ps, "TimeLimitCPU", REQUIRED, 0, "CPU time to run for in seconds. Code will stop if it notices that the time to end of the next PM step is longer than the remaining time.");
98 
99  param_declare_int (ps, "MaxDomainTimeBinDepth", OPTIONAL, 8, "Forces a domain decompositon every 2^MaxDomainTimeBinDepth timesteps.");
100  param_declare_int (ps, "DomainOverDecompositionFactor", OPTIONAL, -1, "Create on average this number of sub domains on a MPI rank. Higher numbers improve the load balancing. For optimal tree building efficiency, use one domain per thread (the default).");
101  param_declare_double(ps, "RandomParticleOffset", OPTIONAL, 8., "Internally shift the particles within a periodic box by a random fraction of a PM grid cell each domain decomposition, ensuring that tree openings are decorrelated between timesteps. This shift is subtracted before particles are saved.");
102 
103  param_declare_int (ps, "DomainUseGlobalSorting", OPTIONAL, 1, "Determining the initial refinement of chunks globally. Enabling this produces better domains at costs of slowing down the domain decomposition.");
104  param_declare_double(ps, "ErrTolIntAccuracy", OPTIONAL, 0.02, "Controls the length of the short-range timestep. Smaller values are shorter timesteps.");
105  param_declare_double(ps, "ErrTolForceAcc", OPTIONAL, 0.002, "Force accuracy required from tree. Controls tree opening criteria. Lower values are more accurate.");
106  param_declare_double(ps, "BHOpeningAngle", OPTIONAL, 0.175, "Barnes-Hut opening angle. Alternative purely geometric tree opening angle. Lower values are more accurate.");
107  param_declare_double(ps, "TreeRcut", OPTIONAL, 6, "Number of mesh cells at which we cease walking.");
108  param_declare_int(ps, "TreeUseBH", OPTIONAL, 2, "If 1, use Barnes-Hut opening angle rather than the standard Gadget acceleration based opening angle. If 2, use BH criterion for the first timestep only, before we have relative accelerations.");
109  param_declare_double(ps, "Asmth", OPTIONAL, 1.5, "The scale of the short-range/long-range force split in units of FFT-mesh cells."
110  "Larger values suppresses grid anisotropy. ShortRangeForceWindowType = erfc supports any value. 'exact' only supports 1.5. ");
111  param_declare_int(ps, "Nmesh", OPTIONAL, -1, "Size of the PM grid on which to compute the long-range force.");
112 
113  static ParameterEnum ShortRangeForceWindowTypeEnum [] = {
117  };
118  param_declare_enum(ps, "ShortRangeForceWindowType", ShortRangeForceWindowTypeEnum, OPTIONAL, "exact", "type of shortrange window, exact or erfc (default is exact) ");
119 
120  param_declare_double(ps, "MinGasHsmlFractional", OPTIONAL, 0, "Minimal gas Hsml as a fraction of gravity softening.");
121  param_declare_double(ps, "MaxGasVel", OPTIONAL, 3e5, "Maximal limit on the gas velocity in km/s. By default speed of light.");
122 
123  /*Setting MaxSizeTimestep = 0.05 increases the power on large scales by a constant factor of 1.002.*/
124  param_declare_double(ps, "MaxSizeTimestep", OPTIONAL, 0.1, "Maximum size of the PM timestep (as delta-a).");
125  param_declare_double(ps, "MinSizeTimestep", OPTIONAL, 0, "Minimum size of the PM timestep.");
126  param_declare_int(ps, "ForceEqualTimesteps", OPTIONAL, 0, "Force all (tree) timesteps to be the same, and equal to the smallest required.");
127 
128  /* MaxRMSDisplacementFac = 0.1 increases the power on large scales by a small constant factor of 1.0005. */
129  param_declare_double(ps, "MaxRMSDisplacementFac", OPTIONAL, 0.2, "Controls the length of the PM timestep. Max RMS displacement per timestep in units of the mean particle separation.");
130  param_declare_double(ps, "ArtBulkViscConst", OPTIONAL, 0.75, "Artificial viscosity constant for SPH.");
131  param_declare_double(ps, "CourantFac", OPTIONAL, 0.15, "Courant factor for the timestepping.");
132  param_declare_double(ps, "DensityResolutionEta", OPTIONAL, 1.0, "Resolution eta factor (See Price 2008) 1 = 33 for Cubic Spline");
133 
134  param_declare_double(ps, "DensityContrastLimit", OPTIONAL, 100, "Has an effect only if DensityIndepndentSphOn=1. If = 0 enables the grad-h term in the SPH calculation. If > 0 also sets a maximum density contrast for hydro force calculation.");
135  param_declare_double(ps, "MaxNumNgbDeviation", OPTIONAL, 2, "Maximal deviation from the desired number of neighbours for each SPH particle.");
136  param_declare_double(ps, "HydroCostFactor", OPTIONAL, 1, "Unused.");
137 
138  param_declare_int(ps, "BytesPerFile", OPTIONAL, 1024 * 1024 * 1024, "number of bytes per file");
139  param_declare_int(ps, "NumWriters", OPTIONAL, 0, "Max number of concurrent writer processes. 0 implies Number of Tasks; ");
140  param_declare_int(ps, "MinNumWriters", OPTIONAL, 1, "Min number of concurrent writer processes. We increase number of Files to avoid too few writers. ");
141  param_declare_int(ps, "WritersPerFile", OPTIONAL, 8, "Number of Writer groups assigned to a file; total number of writers is capped by NumWriters.");
142 
143  param_declare_int(ps, "EnableAggregatedIO", OPTIONAL, 0, "Use the Aggregated IO policy for small data set (Experimental).");
144  param_declare_int(ps, "AggregatedIOThreshold", OPTIONAL, 1024 * 1024 * 256, "Max number of bytes on a writer before reverting to throttled IO.");
145 
146  /*Parameters of the cooling module*/
147  param_declare_int(ps, "CoolingOn", REQUIRED, 0, "Enables cooling");
148  param_declare_string(ps, "TreeCoolFile", OPTIONAL, "", "Path to the Cooling Table");
149  param_declare_string(ps, "MetalCoolFile", OPTIONAL, "", "Path to the Metal Cooling Table. Empty string disables metal cooling. Refer to cooling.c");
150  param_declare_string(ps, "ReionHistFile", OPTIONAL, "", "Path to the file containing the helium III reionization table. Used if QSOLightupOn = 1.");
151  param_declare_string(ps, "UVFluctuationFile", OPTIONAL, "", "Path to the UVFluctation Table. Refer to cooling.c.");
152  param_declare_double(ps, "HIReionTemp", OPTIONAL, 0, "Boost the particle temperature to this value during the timestep when it undergoes HI reionization. Do not boost star-forming gas. 1807.09282 suggests a boost of 20000.");
153  param_declare_double(ps, "UVRedshiftThreshold", OPTIONAL, -1.0, "Earliest Redshift that UV background is enabled. This modulates UVFluctuation and TreeCool globally. Default -1.0 means no modulation.");
154  static ParameterEnum CoolingTypeTable [] = {
155  {"KWH92", KWH92 },
156  {"Enzo2Nyx", Enzo2Nyx },
157  {"Sherwood", Sherwood },
158  {NULL, Cen92 },
159  };
160  static ParameterEnum RecombTypeTable [] = {
161  {"Cen92", Cen92 },
162  {"Verner96", Verner96 },
163  {"Badnell06", Badnell06},
164  {NULL, Cen92 },
165  };
166  param_declare_enum(ps, "CoolingRates", CoolingTypeTable, OPTIONAL, "Sherwood", "Which cooling rate table to use. Options are KWH92 (old gadget default), Enzo2Nyx and Sherwood (new default).");
167  param_declare_enum(ps, "RecombRates", RecombTypeTable, OPTIONAL, "Verner96", "Which recombination rate table to use. Options are Cen92 (old gadget default), Verner96 (new default), Badnell06");
168  param_declare_int(ps, "SelfShieldingOn", OPTIONAL, 1, "Enable a correction in the cooling table for self-shielding.");
169  param_declare_double(ps, "PhotoIonizeFactor", OPTIONAL, 1, "Scale the TreeCool table by this factor.");
170  param_declare_int(ps, "PhotoIonizationOn", OPTIONAL, 1, "Should PhotoIonization be enabled.");
171  /* End cooling module parameters*/
172 
173  param_declare_int(ps, "HydroOn", OPTIONAL, 1, "Enables hydro force");
174  param_declare_int(ps, "DensityOn", OPTIONAL, 1, "Enables SPH density computation.");
175  param_declare_int(ps, "DensityIndependentSphOn", REQUIRED, 1, "Enables density-independent (pressure-entropy) SPH.");
176  param_declare_int(ps, "LightconeOn", OPTIONAL, 0, "Enables a wildly experimental lightcone algorithm that writes particles crossing a lightcone boundary to a file. May not work!");
177  param_declare_int(ps, "TreeGravOn", OPTIONAL, 1, "Enables tree gravity");
178  param_declare_int(ps, "RadiationOn", OPTIONAL, 1, "Include radiation density in the background evolution.");
179  param_declare_int(ps, "FastParticleType", OPTIONAL, 2, "Particles of this type will not decrease the timestep. Default neutrinos.");
180  param_declare_double(ps, "PairwiseActiveFraction", OPTIONAL, 0, "Pairwise gravity instead of tree gravity is used if N(active particles) / N(particles) is less than this. Usually slower.");
181 
182  param_declare_double(ps, "GravitySoftening", OPTIONAL, 1./30., "Softening for collisionless particles; units of mean separation of DM. ForceSoftening is 2.8 times this.");
183  param_declare_int(ps, "GravitySofteningGas", OPTIONAL, 1, "0 to use adaptive softening, where the gas softening is the smoothing length of the last step.");
184 
185  param_declare_int(ps, "ImportBufferBoost", OPTIONAL, 2, "Memory factor to allow for there being more particles imported during treewlk than exported. Increase this if code crashes during treewalk with out of memory.");
186  param_declare_double(ps, "PartAllocFactor", OPTIONAL, 1.5, "Over-allocation factor of particles. The load can be imbalanced to allow for the work to be more balanced.");
187  param_declare_double(ps, "TopNodeAllocFactor", OPTIONAL, 0.5, "Initial TopNode allocation as a fraction of maximum particle number.");
188  param_declare_double(ps, "SlotsIncreaseFactor", OPTIONAL, 0.01, "Percentage factor to increase slot allocation by when requested.");
189 
190  param_declare_double(ps, "InitGasTemp", OPTIONAL, -1, "Initial gas temperature. By default set to CMB temperature at starting redshift.");
191  param_declare_double(ps, "MinGasTemp", OPTIONAL, 5, "Minimum gas temperature");
192 
193  param_declare_int(ps, "SnapshotWithFOF", REQUIRED, 0, "Enable Friends-of-Friends halo finder.");
194  param_declare_int(ps, "FOFPrimaryLinkTypes", OPTIONAL, 2, "2^ particle types to use as primary FOF targets.");
195  param_declare_int(ps, "FOFSecondaryLinkTypes", OPTIONAL, 1+16+32, "2^ particle types to link to nearest primaries.");
196  param_declare_int(ps, "FOFSaveParticles", OPTIONAL, 1, "Save particles in the FOF catalog.");
197  param_declare_double(ps, "FOFHaloLinkingLength", OPTIONAL, 0.2, "Linking length for Friends of Friends halos.");
198  param_declare_int(ps, "FOFHaloMinLength", OPTIONAL, 32, "Minimum number of particles per FOF Halo.");
199  param_declare_double(ps, "MinFoFMassForNewSeed", OPTIONAL, 2, "Minimal halo mass for seeding tracer particles in internal mass units.");
200  param_declare_double(ps, "MinMStarForNewSeed", OPTIONAL, 5e-4, "Minimal stellar mass in halo for seeding black holes in internal mass units.");
201  param_declare_double(ps, "TimeBetweenSeedingSearch", OPTIONAL, 1.04, "Scale factor fraction increase between Seeding Attempts.");
202 
203  /*Black holes*/
204  param_declare_int(ps, "BlackHoleOn", REQUIRED, 1, "Master switch to enable black hole formation and feedback. If this is on, type 5 particles are treated as black holes.");
205  param_declare_int(ps, "MetalReturnOn", REQUIRED, 1, "Enable the return of metals from star particles to the gas.");
206 
207  param_declare_double(ps, "BlackHoleAccretionFactor", OPTIONAL, 100, "BH accretion boosting factor relative to the rate from the Bondi accretion model.");
208  param_declare_double(ps, "BlackHoleEddingtonFactor", OPTIONAL, 2.1, "Maximum Black hole accretion as a function of Eddington.");
209  param_declare_double(ps, "SeedBlackHoleMass", OPTIONAL, 2e-5, "Mass of initial black hole seed in internal mass units. If this is too much smaller than the gas particle mass, BH will not accrete.");
210  param_declare_double(ps, "MaxSeedBlackHoleMass", OPTIONAL, 0, "Black hole seed masses are drawn from a power law. This is the upper limit on the BH seed mass. If <= 0 then all BHs have the SeedBlackHoleMass and the power law is disabled.");
211  param_declare_double(ps, "SeedBlackHoleMassIndex", OPTIONAL, -2, "Power law index of the seed mass distribution");
212 
213  param_declare_double(ps, "BlackHoleNgbFactor", OPTIONAL, 2, "Factor by which to increase the number of neighbours for a black hole.");
214 
215  param_declare_double(ps, "BlackHoleMaxAccretionRadius", OPTIONAL, 99999., "NO EFFECT. Was maximum search radius for black holes.");
216  param_declare_double(ps, "BlackHoleFeedbackFactor", OPTIONAL, 0.05, " Fraction of the black hole luminosity to turn into thermal energy");
217  param_declare_double(ps, "BlackHoleFeedbackRadius", OPTIONAL, 0, "NO EFFECT. Was the comoving radius at which the black hole feedback energy was deposited. Did not affect accretion so had odd behaviour.");
218  param_declare_int(ps, "BlackHoleRepositionEnabled", OPTIONAL, 1, "Enables Black hole repositioning to the potential minimum.");
219 
220  param_declare_int(ps, "BlackHoleKineticOn", OPTIONAL, 0, "Switch to AGN kinetic feedback when Eddington accretion is low.");
221  param_declare_double(ps,"BHKE_EddingtonThrFactor",OPTIONAL, 0.05, "Threshold of the Eddington rate for the kinetic feedback");
222  param_declare_double(ps,"BHKE_EddingtonMFactor",OPTIONAL, 0.002, "Factor for mbh-dependent Eddington threshold for the kinetic feedback");
223  param_declare_double(ps,"BHKE_EddingtonMPivot",OPTIONAL, 0.05, "Pivot MBH for mbh-dependent Eddington threshold for the kinetic feedback");
224  param_declare_double(ps,"BHKE_EddingtonMIndex",OPTIONAL, 2, "Powlaw index for mbh-dependent Eddington threshold for the kinetic feedback");
225  param_declare_double(ps,"BHKE_EffRhoFactor",OPTIONAL, 0.05, "Factor1 for kinetic feedback efficiency, compare with BH density");
226  param_declare_double(ps,"BHKE_EffCap",OPTIONAL, 0.05, "Factor2 for kinetic feedback efficiency, sets the maximum factor that converts accretion energy to kinetic feedback");
227  param_declare_double(ps,"BHKE_InjEnergyThr",OPTIONAL, 5, "Factor for Minimum KineticFeedbackEnergy injection, controls the burstiness of kinetic feedback");
228 
229  param_declare_double(ps, "BlackHoleFeedbackRadiusMaxPhys", OPTIONAL, 0, "If set, the physical radius at which the black hole feedback energy is deposited. When both this flag and BlackHoleFeedbackRadius are both set, the smaller radius is used.");
230  param_declare_int(ps,"WriteBlackHoleDetails",OPTIONAL, 0, "If set, output BH details at every time step.");
231 
232  param_declare_int(ps,"BH_DynFrictionMethod",OPTIONAL, 0, "If set to non-zero, dynamical friction is applied through this method. Setting BH_DynFrictionMethod = 1, = 2, = 3 uses stars only (=1), dark matter + stars (=2), all mass (=3) to compute the DF force.");
233  param_declare_int(ps,"BH_DFBoostFactor",OPTIONAL, 1, "If set, dynamical friction is boosted by this factor.");
234  param_declare_double(ps,"BH_DFbmax",OPTIONAL, 20, "Maximum impact range for dynamical friction. We use 20 pkpc as default value.");
235  param_declare_int(ps,"BH_DRAG",OPTIONAL, 0, "Add drag force to the BH dynamic");
236  param_declare_int(ps,"MergeGravBound",OPTIONAL, 1, "If set to 1, apply gravitational bound criteria for merging event. This criteria would be automatically turned off if reposition is enabled.");
237  param_declare_double(ps, "SeedBHDynMass", OPTIONAL, -1, "The initial dynamic mass of BH, default -1 will use the mass of gas particle. Larger Mdyn would help to stablize the BH in the early phase if turning off reposition.");
238 
239  static ParameterEnum BlackHoleFeedbackMethodEnum [] = {
240  {"mass", BH_FEEDBACK_MASS},
241  {"volume", BH_FEEDBACK_VOLUME},
242  {"tophat", BH_FEEDBACK_TOPHAT},
243  {"spline", BH_FEEDBACK_SPLINE},
245  };
246  param_declare_enum(ps, "BlackHoleFeedbackMethod", BlackHoleFeedbackMethodEnum,
247  OPTIONAL, "spline, mass", "");
248  /*End black holes*/
249 
250  /*Star formation parameters*/
251  static ParameterEnum StarformationCriterionEnum [] = {
252  {"density", SFR_CRITERION_DENSITY}, /* SH03 density model for star formation*/
253  {"h2", SFR_CRITERION_MOLECULAR_H2}, /* Form stars depending on the computed
254  molecular gas fraction as a function of metallicity. */
255  {"selfgravity", SFR_CRITERION_SELFGRAVITY}, /* Form stars only when the gas is self-gravitating. From Phil Hopkins.*/
256  {"convergent", SFR_CRITERION_CONVERGENT_FLOW}, /* Modify self-gravitating star formation to form stars only when the gas flow is convergent. From Phil Hopkins.*/
257  {"continuous", SFR_CRITERION_CONTINUOUS_CUTOFF}, /* Modify self-gravitating star formation to smooth the star formation threshold. From Phil Hopkins.*/
258  {NULL, SFR_CRITERION_DENSITY},
259  };
260 
261  static ParameterEnum WindModelEnum [] = {
262  {"subgrid", WIND_SUBGRID}, /* If this is true, winds are spawned from the star forming gas.
263  If false, they are spawned from neighbours of the star particle.*/
264  {"decouple", WIND_DECOUPLE_SPH}, /* Specifies that wind particles are created temporarily decoupled from the gas dynamics */
265  {"halo", WIND_USE_HALO}, /* Wind speeds depend on the halo circular velocity*/
266  {"fixedefficiency", WIND_FIXED_EFFICIENCY}, /* Winds have a fixed efficiency and thus fixed wind speed*/
267  {"sh03", WIND_SUBGRID | WIND_DECOUPLE_SPH | WIND_FIXED_EFFICIENCY} , /*The canonical model of Spring & Hernquist 2003*/
268  {"vs08", WIND_FIXED_EFFICIENCY},
269  {"ofjt10", WIND_USE_HALO | WIND_DECOUPLE_SPH},
270  {"isotropic", WIND_ISOTROPIC}, /*Does nothing: wind direction is always random and isotropic.*/
271  {NULL, WIND_USE_HALO | WIND_DECOUPLE_SPH }, /* Default is ofjt10*/
272  };
273 
274  param_declare_int(ps, "StarformationOn", REQUIRED, 0, "Enables star formation");
275  param_declare_int(ps, "WindOn", REQUIRED, 0, "Enables wind feedback");
276  param_declare_enum(ps, "StarformationCriterion",
277  StarformationCriterionEnum, OPTIONAL, "density", "Extra star formation criteria to use. Default is density which corresponds to the SH03 model.");
278 
279  /*See Springel & Hernquist 2003 for the meaning of these parameters*/
280  param_declare_double(ps, "CritOverDensity", OPTIONAL, 57.7, "Threshold over-density (in units of the critical density) for gas to be star forming.");
281  param_declare_double(ps, "CritPhysDensity", OPTIONAL, 0, "Threshold physical density (in protons/cm^3) for gas to be star forming. If zero this is worked out from CritOverDensity.");
282 
283  param_declare_int(ps, "BHFeedbackUseTcool", OPTIONAL, 1, "Control how BH feedback interacts with the SFR. If 0, star-forming gas which is heated by a BH remains pressurized (and thus does not cool). If 1, it cools exponentially to the EEQOS using the cooling time rather than the relaxation time. If 2, gas more than 0.3 dex above the EOS temp just cools normally. 1 and 2 give similar BH output, but 1 is 50% faster due to the smaller timebins populated by 2.");
284  param_declare_double(ps, "FactorSN", OPTIONAL, 0.1, "Fraction of the gas energy which is locally returned as supernovae on star formation.");
285  param_declare_double(ps, "FactorEVP", OPTIONAL, 1000, "Parameter of the SH03 model, controlling the energy of the hot gas.");
286  param_declare_double(ps, "TempSupernova", OPTIONAL, 1e8, "Temperature of the supernovae remnants in K.");
287  param_declare_double(ps, "TempClouds", OPTIONAL, 1000, "Temperature of the cold star forming clouds in K.");
288  param_declare_double(ps, "MaxSfrTimescale", OPTIONAL, 1.5, "Maximum star formation time in units of the density threshold.");
289  param_declare_int(ps, "Generations", OPTIONAL, 4, "Number of stars to create per gas particle.");
290  param_declare_enum(ps, "WindModel", WindModelEnum, OPTIONAL, "ofjt10", "Wind model to use. Default is the varying wind velocity model with isotropic winds.");
291 
292  /* The following two are for VS08 and SH03*/
293  param_declare_double(ps, "WindEfficiency", OPTIONAL, 2.0, "Fraction of the stellar mass that goes into a wind. Needs sh03 or vs08 wind models.");
294  param_declare_double(ps, "WindEnergyFraction", OPTIONAL, 1.0, "Fraction of the available energy that goes into winds.");
295 
296  /* The following two are for OFJT10*/
297  param_declare_double(ps, "WindSigma0", OPTIONAL, 353, "Reference halo circular velocity at which to evaluate wind speed. Needs ofjt10 wind model.");
298  param_declare_double(ps, "WindSpeedFactor", OPTIONAL, 3.7, "Factor connecting wind speed to halo circular velocity. ofjt10 wind model.");
299 
300  param_declare_double(ps, "WindFreeTravelLength", OPTIONAL, 20, "Expected decoupling distance for the wind in internal distance units.");
301  param_declare_double(ps, "WindFreeTravelDensFac", OPTIONAL, 0.1, "If the density of the wind particle drops below this factor of the star formation density threshold, the gas will recouple.");
302  param_declare_double(ps, "MinWindVelocity", OPTIONAL, 0, "Minimum velocity of the kicked particle in the wind, in internal units (physical km/s).");
303  param_declare_double(ps, "WindThermalFactor", OPTIONAL, 0, "Fraction of the wind energy which comes thermally rather than kinetic.");
304 
305  param_declare_double(ps, "MaxWindFreeTravelTime", OPTIONAL, 60, "Maximum time in Myrs for the wind to be decoupled.");
306 
307  param_declare_int(ps, "RandomSeed", OPTIONAL, 42, "Random number generator initial seed. Used to form stars.");
308 
309  /*These parameters are Lyman alpha forest specific*/
310  param_declare_double(ps, "QuickLymanAlphaProbability", OPTIONAL, 0, "Probability gas is turned directly into stars, irrespective of pressure. One is equivalent to quick lyman alpha star formation.");
311  param_declare_double(ps, "QuickLymanAlphaTempThresh", OPTIONAL, 1e5, "Temperature threshold for gas to be star forming in the quick lyman alpha model, in K. Gas above this temperature does not form stars.");
312  param_declare_double(ps, "HydrogenHeatAmp", OPTIONAL, 1, "Density-independent heat boost to hydrogen.");
313  /* Enable model for helium reionisation which adds extra photo-heating to under-dense gas.
314  * Extra heating has the form: H = Amp * (rho / rho_c(z=0))^Exp
315  * but is density-independent when rho / rho_c > Thresh. */
316  param_declare_int(ps, "HeliumHeatOn", OPTIONAL, 0, "Change photo-heating rate to model helium reionisation on underdense gas.");
317  param_declare_double(ps, "HeliumHeatThresh", OPTIONAL, 10, "Overdensity above which heating is density-independent.");
318  param_declare_double(ps, "HeliumHeatAmp", OPTIONAL, 1, "Density-independent heat boost. Changes mean temperature.");
319  param_declare_double(ps, "HeliumHeatExp", OPTIONAL, 0, "Density dependent heat boost (exponent). Changes gamma.");
320  /*End of star formation parameters*/
321  /* Parameters for the QSO lightup model for helium reionization*/
322  param_declare_int(ps, "QSOLightupOn", OPTIONAL, 0, "Enable the quasar lighup model for helium reionization");
323  /* Default QSO BH masses correspond to the Illustris BHs hosted in halos between 2x10^12 and 10^13 solar masses.
324  * In small boxes this may be too small.*/
325  param_declare_double(ps, "QSOMaxMass", OPTIONAL, 1000, "Maximum mass of a halo potentially hosting a quasar in internal mass units.");
326  param_declare_double(ps, "QSOMinMass", OPTIONAL, 100, "Minimum mass of a halo potentially hosting a quasar in internal mass units.");
327  param_declare_double(ps, "QSOMeanBubble", OPTIONAL, 20000, "Mean size of the ionizing bubble around a quasar. By default 20 Mpc/h = 28 Mpc. 0807.2799");
328  param_declare_double(ps, "QSOVarBubble", OPTIONAL, 0, "Variance of the ionizing bubble around a quasar. By default zero so all bubbles are the same size");
329  param_declare_double(ps, "QSOHeIIIReionFinishFrac", OPTIONAL, 0.995, "Reionization fraction at which all particles are flash-reionized instead of having quasar bubbles placed.");
330 
331  /* Parameters for the metal return model*/
332  param_declare_double(ps, "MetalsSn1aN0", OPTIONAL, 1.3e-3, "Overall rate of SN1a per Msun");
333  param_declare_double(ps, "MetalsMaxNgbDeviation", OPTIONAL, 5., "Maximum variance in the number of neighbours metals are returned to.");
334  param_declare_int(ps, "MetalsSPHWeighting", OPTIONAL, 1, "If true, return metals to gas with a volume-weighted SPH kernel. If false use a volume-weighted uniform kernel.");
335 
336  /*Parameters for the massive neutrino model*/
337  param_declare_int(ps, "MassiveNuLinRespOn", REQUIRED, 0, "Enables linear response massive neutrinos of 1209.0461. Make sure you enable radiation too.");
338  param_declare_int(ps, "HybridNeutrinosOn", OPTIONAL, 0, "Enables hybrid massive neutrinos, where some density is followed analytically, and some with particles. Requires MassivenuLinRespOn");
339  param_declare_double(ps, "MNue", OPTIONAL, 0, "First neutrino mass in eV.");
340  param_declare_double(ps, "MNum", OPTIONAL, 0, "Second neutrino mass in eV.");
341  param_declare_double(ps, "MNut", OPTIONAL, 0, "Third neutrino mass in eV.");
342  param_declare_double(ps, "Vcrit", OPTIONAL, 500., "For hybrid neutrinos: Critical velocity (in km/s) in the Fermi-Dirac distribution below which the neutrinos are particles in the ICs.");
343  param_declare_double(ps, "NuPartTime", OPTIONAL, 0.3333333, "Scale factor at which to turn on hybrid neutrino particles.");
344  /*End parameters for the massive neutrino model*/
345 
346  param_set_action(ps, "BlackHoleFeedbackMethod", BlackHoleFeedbackMethodAction, NULL);
347  param_set_action(ps, "StarformationCriterion", StarformationCriterionAction, NULL);
348  param_set_action(ps, "OutputList", OutputListAction, NULL);
349 
350  return ps;
351 }
@ Sherwood
Definition: cooling_rates.h:19
@ KWH92
Definition: cooling_rates.h:17
@ Enzo2Nyx
Definition: cooling_rates.h:18
@ Cen92
Definition: cooling_rates.h:11
@ Verner96
Definition: cooling_rates.h:12
@ Badnell06
Definition: cooling_rates.h:13
@ DENSITY_KERNEL_CUBIC_SPLINE
Definition: densitykernel.h:18
@ DENSITY_KERNEL_QUINTIC_SPLINE
Definition: densitykernel.h:19
@ DENSITY_KERNEL_QUARTIC_SPLINE
Definition: densitykernel.h:20
static int BlackHoleFeedbackMethodAction(ParameterSet *ps, const char *name, void *data)
Definition: params.c:28
static int StarformationCriterionAction(ParameterSet *ps, const char *name, void *data)
Definition: params.c:43
@ SHORTRANGE_FORCE_WINDOW_TYPE_ERFC
Definition: gravity.h:25
@ SHORTRANGE_FORCE_WINDOW_TYPE_EXACT
Definition: gravity.h:24
void param_declare_enum(ParameterSet *ps, const char *name, ParameterEnum *enumtable, const enum ParameterFlag required, const char *defvalue, const char *help)
Definition: paramset.c:307
void param_declare_double(ParameterSet *ps, const char *name, const enum ParameterFlag required, const double defvalue, const char *help)
Definition: paramset.c:278
void param_declare_int(ParameterSet *ps, const char *name, const enum ParameterFlag required, const int defvalue, const char *help)
Definition: paramset.c:267
void param_set_action(ParameterSet *ps, const char *name, ParameterAction action, void *userdata)
Definition: paramset.c:321
void param_declare_string(ParameterSet *ps, const char *name, const enum ParameterFlag required, const char *defvalue, const char *help)
Definition: paramset.c:289
ParameterSet * parameter_set_new()
Definition: paramset.c:472
@ OPTIONAL
Definition: paramset.h:8
@ REQUIRED
Definition: paramset.h:7
@ SFR_CRITERION_MOLECULAR_H2
Definition: sfr_eff.h:18
@ SFR_CRITERION_CONVERGENT_FLOW
Definition: sfr_eff.h:21
@ SFR_CRITERION_CONTINUOUS_CUTOFF
Definition: sfr_eff.h:22
@ SFR_CRITERION_SELFGRAVITY
Definition: sfr_eff.h:19
@ SFR_CRITERION_DENSITY
Definition: sfr_eff.h:17
int OutputListAction(ParameterSet *ps, const char *name, void *data)
Definition: timebinmgr.c:31
@ WIND_ISOTROPIC
Definition: winds.h:18
@ WIND_FIXED_EFFICIENCY
Definition: winds.h:17
@ WIND_USE_HALO
Definition: winds.h:16
@ WIND_DECOUPLE_SPH
Definition: winds.h:15
@ WIND_SUBGRID
Definition: winds.h:13

References Badnell06, BH_FEEDBACK_MASS, BH_FEEDBACK_SPLINE, BH_FEEDBACK_TOPHAT, BH_FEEDBACK_VOLUME, BlackHoleFeedbackMethodAction(), Cen92, DENSITY_KERNEL_CUBIC_SPLINE, DENSITY_KERNEL_QUARTIC_SPLINE, DENSITY_KERNEL_QUINTIC_SPLINE, Enzo2Nyx, KWH92, OPTIONAL, OutputListAction(), param_declare_double(), param_declare_enum(), param_declare_int(), param_declare_string(), param_set_action(), parameter_set_new(), REQUIRED, SFR_CRITERION_CONTINUOUS_CUTOFF, SFR_CRITERION_CONVERGENT_FLOW, SFR_CRITERION_DENSITY, SFR_CRITERION_MOLECULAR_H2, SFR_CRITERION_SELFGRAVITY, Sherwood, SHORTRANGE_FORCE_WINDOW_TYPE_ERFC, SHORTRANGE_FORCE_WINDOW_TYPE_EXACT, StarformationCriterionAction(), Verner96, WIND_DECOUPLE_SPH, WIND_FIXED_EFFICIENCY, WIND_ISOTROPIC, WIND_SUBGRID, and WIND_USE_HALO.

Referenced by read_parameter_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_parameter_file()

void read_parameter_file ( char *  fname,
int *  ShowBacktrace,
double *  MaxMemSizePerNode 
)

This function parses the parameterfile in a simple way. Each paramater is defined by a keyword (‘tag’), and can be either of type douple, int, or character string. The routine makes sure that each parameter appears exactly once in the parameterfile, otherwise error messages are produced that complain about the missing parameters.

Definition at line 359 of file params.c.

360 {
362 
363  int ThisTask;
364  MPI_Comm_rank(MPI_COMM_WORLD, &ThisTask);
365 
366  if(0 != param_parse_file(ps, fname)) {
367  endrun(1, "Parsing %s failed.\n", fname);
368  }
369  if(0 != param_validate(ps)) {
370  endrun(1, "Validation of %s failed: %s\n", fname);
371  }
372 
373  message(0, "----------- Running with Parameters ----------\n");
374  if(ThisTask == 0)
375  param_dump(ps, stdout);
376  message(0, "----------------------------------------------\n");
377 
378  *ShowBacktrace = param_get_int(ps, "ShowBacktrace");
379  *MaxMemSizePerNode = param_get_double(ps, "MaxMemSizePerNode");
380  if(*MaxMemSizePerNode <= 1) {
381  *MaxMemSizePerNode *= get_physmem_bytes() / (1024. * 1024.);
382  }
383 
384  /*Initialize per-module parameters.*/
386  set_init_params(ps);
387  set_petaio_params(ps);
389  set_cooling_params(ps);
390  set_density_params(ps);
391  set_hydro_params(ps);
395  set_domain_params(ps);
396  set_sfr_params(ps);
397  set_winds_params(ps);
398  set_fof_params(ps);
401  set_stats_params(ps);
402  parameter_set_free(ps);
403 }
void set_blackhole_params(ParameterSet *ps)
Definition: blackhole.c:257
void set_qso_lightup_params(ParameterSet *ps)
void set_cooling_params(ParameterSet *ps)
void set_density_params(ParameterSet *ps)
Definition: density.c:32
void set_domain_params(ParameterSet *ps)
Definition: domain.c:84
static int ShowBacktrace
Definition: endrun.c:100
void endrun(int where, const char *fmt,...)
Definition: endrun.c:147
void set_fof_params(ParameterSet *ps)
Definition: fof.c:50
static ParameterSet * create_gadget_parameter_set()
Definition: params.c:54
void set_gravshort_tree_params(ParameterSet *ps)
void set_hydro_params(ParameterSet *ps)
Definition: hydra.c:37
void set_init_params(ParameterSet *ps)
Definition: init.c:45
void set_metal_return_params(ParameterSet *ps)
Definition: metal_return.c:62
double param_get_double(ParameterSet *ps, const char *name)
Definition: paramset.c:336
void parameter_set_free(ParameterSet *ps)
Definition: paramset.c:480
int param_parse_file(ParameterSet *ps, const char *filename)
Definition: paramset.c:234
int param_get_int(ParameterSet *ps, const char *name)
Definition: paramset.c:368
void param_dump(ParameterSet *ps, FILE *stream)
Definition: paramset.c:192
int param_validate(ParameterSet *ps)
Definition: paramset.c:177
void set_petaio_params(ParameterSet *ps)
Definition: petaio.c:57
void set_all_global_params(ParameterSet *ps)
Definition: run.c:106
void set_sfr_params(ParameterSet *ps)
Definition: sfr_eff.c:129
void set_stats_params(ParameterSet *ps)
Definition: stats.c:55
double get_physmem_bytes(void)
Definition: system.c:467
int ThisTask
Definition: test_exchange.c:23
void set_timestep_params(ParameterSet *ps)
Definition: timestep.c:51
void set_treewalk_params(ParameterSet *ps)
Definition: treewalk.c:55
void set_winds_params(ParameterSet *ps)
Definition: winds.c:72

References create_gadget_parameter_set(), endrun(), get_physmem_bytes(), message(), param_dump(), param_get_double(), param_get_int(), param_parse_file(), param_validate(), parameter_set_free(), set_all_global_params(), set_blackhole_params(), set_cooling_params(), set_density_params(), set_domain_params(), set_fof_params(), set_gravshort_tree_params(), set_hydro_params(), set_init_params(), set_metal_return_params(), set_petaio_params(), set_qso_lightup_params(), set_sfr_params(), set_stats_params(), set_timestep_params(), set_treewalk_params(), set_winds_params(), ShowBacktrace, and ThisTask.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StarformationCriterionAction()

static int StarformationCriterionAction ( ParameterSet ps,
const char *  name,
void *  data 
)
static

Definition at line 43 of file params.c.

44 {
45  int v = param_get_enum(ps, name);
46  if(!HAS(v, SFR_CRITERION_DENSITY)) {
47  message(1, "error: At least use SFR_CRITERION_DENSITY\n");
48  return 1;
49  }
50  return 0;
51 }

References HAS, message(), name, param_get_enum(), and SFR_CRITERION_DENSITY.

Referenced by create_gadget_parameter_set().

Here is the call graph for this function:
Here is the caller graph for this function: