MP-Gadget
5.0.1.dev1-76bc7d4726-dirty
|
code for initialisation of a simulation from initial conditions More...
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <mpi.h>
#include <gsl/gsl_sf_gamma.h>
#include "init.h"
#include "utils.h"
#include "cooling.h"
#include "forcetree.h"
#include "density.h"
#include "timefac.h"
#include "petaio.h"
#include "domain.h"
#include "walltime.h"
#include "slotsmanager.h"
#include "hydra.h"
#include "sfr_eff.h"
#include "exchange.h"
#include "fof.h"
#include "timestep.h"
#include "timebinmgr.h"
#include "cosmology.h"
#include "gravity.h"
#include "physconst.h"
Go to the source code of this file.
Classes | |
struct | init_params |
Functions | |
void | set_init_params (ParameterSet *ps) |
void | init_timeline (int RestartSnapNum, double TimeMax, const struct header_data *header, const int SnapshotWithFOF) |
static void | get_mean_separation (double *MeanSeparation, const double BoxSize, const int64_t *NTotalInit) |
static void | check_omega (struct part_manager_type *PartManager, Cosmology *CP, int generations, double G, double *MassTable) |
static void | check_positions (struct part_manager_type *PartManager) |
static void | check_smoothing_length (struct part_manager_type *PartManager, double *MeanSpacing) |
static void | init_alloc_particle_slot_memory (struct part_manager_type *PartManager, struct slots_manager_type *SlotsManager, const double PartAllocFactor, struct header_data *header, MPI_Comm Comm) |
inttime_t | init (int RestartSnapNum, const char *OutputDir, struct header_data *header, Cosmology *CP) |
void | check_density_entropy (Cosmology *CP, const double MinEgySpec, const double atime) |
static void | setup_density_indep_entropy (const ActiveParticles *act, ForceTree *Tree, Cosmology *CP, struct sph_pred_data *sph_pred, double u_init, double a3, int BlackHoleOn, const inttime_t Ti_Current) |
void | setup_smoothinglengths (int RestartSnapNum, DomainDecomp *ddecomp, Cosmology *CP, int BlackHoleOn, double MinEgySpec, double uu_in_cgs, const inttime_t Ti_Current, const double atime, const int64_t NTotGasInit) |
Variables | |
static struct init_params | InitParams |
code for initialisation of a simulation from initial conditions
Definition in file init.c.
void check_density_entropy | ( | Cosmology * | CP, |
const double | MinEgySpec, | ||
const double | atime | ||
) |
Definition at line 344 of file init.c.
References CP, GAMMA_MINUS1, GRAVITY, HUBBLE, Cosmology::HubbleParam, slots_manager_type::info, message(), Cosmology::OmegaBaryon, slot_info::size, SlotsManager, and SphP.
Referenced by begrun().
|
static |
This routine computes the mass content of the box and compares it to the specified value of Omega-matter. If discrepant, the run is terminated.
Definition at line 184 of file init.c.
References part_manager_type::BoxSize, CP, endrun(), G, get_omega_nu_nopart(), Cosmology::Hubble, Cosmology::MassiveNuLinRespOn, message(), part_manager_type::NumPart, Cosmology::Omega0, Cosmology::ONu, P, PartManager, and sumup_large_ints().
Referenced by init().
|
static |
This routine checks that the initial positions of the particles are within the box. If not, there is likely a bug in the IC generator and we abort. It also checks for multiple zeros in the positions, guarding against a common fs bug.
Definition at line 294 of file init.c.
References part_manager_type::Base, part_manager_type::BoxSize, endrun(), part_manager_type::NumPart, PartManager, and particle_data::Pos.
Referenced by init().
|
static |
This routine checks that the initial smoothing lengths of the particles are sensible and resets them to mean interparticle spacing if not. Guards against a problem writing the snapshot. Matters because a very large initial smoothing length will cause density() to go crazy.
Definition at line 323 of file init.c.
References part_manager_type::BoxSize, message(), part_manager_type::NumPart, P, and PartManager.
Referenced by init().
|
static |
inttime_t init | ( | int | RestartSnapNum, |
const char * | OutputDir, | ||
struct header_data * | header, | ||
Cosmology * | CP | ||
) |
This function reads the initial conditions, allocates storage for the particle data, validates and initialises the particle data.
Definition at line 86 of file init.c.
References BHP, part_manager_type::BoxSize, check_omega(), check_positions(), check_smoothing_length(), CP, domain_test_id_uniqueness(), endrun(), fof_init(), get_generations(), get_mean_separation(), Cosmology::GravInternal, gravshort_set_softenings(), HYDROGEN_MASSFRAC, init_alloc_particle_slot_memory(), init_timebins(), InitParams, header_data::MassTable, MPIU_Barrier, NMETALS, header_data::NTotalInit, part_manager_type::NumPart, P, init_params::PartAllocFactor, PartManager, PEANO(), petaio_read_snapshot(), SlotsManager, SPHP, header_data::TimeSnapshot, and walltime_measure.
Referenced by begrun().
|
static |
Definition at line 222 of file init.c.
References header_data::BoxSize, endrun(), part_manager_type::MaxPart, message(), MPI_INT64, header_data::NLocal, NTask, header_data::NTotal, header_data::NTotalInit, part_manager_type::NumPart, particle_alloc_memory(), PartManager, ptype, slots_reserve(), slots_setup_topology(), SlotsManager, ThisTask, and TotNumPart.
Referenced by init().
void init_timeline | ( | int | RestartSnapNum, |
double | TimeMax, | ||
const struct header_data * | header, | ||
const int | SnapshotWithFOF | ||
) |
Definition at line 56 of file init.c.
References message(), round_down_power_of_two(), setup_sync_points(), ti_from_loga(), TIMEBASE, header_data::TimeIC, and header_data::TimeSnapshot.
Referenced by begrun().
void set_init_params | ( | ParameterSet * | ps | ) |
Definition at line 45 of file init.c.
References init_params::InitGasTemp, InitParams, param_get_double(), init_params::PartAllocFactor, and ThisTask.
Referenced by read_parameter_file().
|
static |
Definition at line 384 of file init.c.
References CP, density(), DensityIndependentSphOn(), DMAX, GAMMA_MINUS1, slots_manager_type::info, init_driftkicktime(), message(), myfree, mymalloc, slot_info::size, SlotsManager, and SphP.
Referenced by setup_smoothinglengths().
void setup_smoothinglengths | ( | int | RestartSnapNum, |
DomainDecomp * | ddecomp, | ||
Cosmology * | CP, | ||
int | BlackHoleOn, | ||
double | MinEgySpec, | ||
double | uu_in_cgs, | ||
const inttime_t | Ti_Current, | ||
const double | atime, | ||
const int64_t | NTotGasInit | ||
) |
This function is used to find an initial smoothing length and initial entropy for each SPH particle. Entropies are set using the initial gas temperature. It guarantees that the number of neighbours will be between desired_ngb-MAXDEV and desired_ngb+MAXDEV. For simplicity, a first guess of the smoothing length is provided to the function density(), which will then iterate if needed to find the right smoothing length.
Definition at line 439 of file init.c.
References ActiveParticles::ActiveParticle, BOLTZMANN, part_manager_type::BoxSize, Cosmology::CMBTemperature, CP, density(), DensityIndependentSphOn(), endrun(), force_get_father(), force_tree_free(), force_tree_rebuild(), GAMMA_MINUS1, GetDensityKernelType(), GetNumNgb(), HYDROGEN_MASSFRAC, slots_manager_type::info, init_driftkicktime(), init_params::InitGasTemp, InitParams, NODE::len, NODE::mass, NODE::mom, MPI_INT64, ForceTree::Nodes, ActiveParticles::NumActiveParticle, part_manager_type::NumPart, Cosmology::Omega0, Cosmology::OmegaBaryon, P, PartManager, PROTONMASS, setup_density_indep_entropy(), slot_info::size, slots_allocate_sph_pred_data(), slots_free_sph_pred_data(), SlotsManager, and SphP.
Referenced by begrun().
|
static |
Referenced by init(), set_init_params(), and setup_smoothinglengths().