MP-Gadget
5.0.1.dev1-76bc7d4726-dirty
|
routines for 'kicking' particles in momentum space and assigning new timesteps More...
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <omp.h>
#include "utils.h"
#include "physconst.h"
#include "timebinmgr.h"
#include "domain.h"
#include "timefac.h"
#include "cosmology.h"
#include "checkpoint.h"
#include "slotsmanager.h"
#include "partmanager.h"
#include "hydra.h"
#include "walltime.h"
#include "timestep.h"
#include "gravity.h"
Go to the source code of this file.
Classes | |
struct | timestep_params |
Enumerations | |
enum | TimeStepType { TI_ACCEL = 0 , TI_COURANT = 1 , TI_ACCRETE = 2 , TI_NEIGH = 3 , TI_HSML = 4 } |
Functions | |
void | set_timestep_params (ParameterSet *ps) |
static int | get_active_particle (const ActiveParticles *act, int pa) |
static int | timestep_eh_slots_fork (EIBase *event, void *userdata) |
static inttime_t | get_timestep_ti (const int p, const inttime_t dti_max, const inttime_t Ti_Current, const double atime, const double hubble, enum TimeStepType *titype) |
static int | get_timestep_bin (inttime_t dti) |
static void | do_the_short_range_kick (int i, double dt_entr, double Fgravkick, double Fhydrokick, const double atime, const double MinEgySpec) |
static inttime_t | get_PM_timestep_ti (const DriftKickTimes *const times, const double atime, const Cosmology *CP, const int FastParticleType, const double asmth) |
inttime_t | init_timebins (double TimeInit) |
DriftKickTimes | init_driftkicktime (inttime_t Ti_Current) |
int | is_timebin_active (int i, inttime_t current) |
int | is_PM_timestep (const DriftKickTimes *const times) |
double | get_atime (const inttime_t Ti_Current) |
int | find_timesteps (const ActiveParticles *act, DriftKickTimes *times, const double atime, int FastParticleType, const Cosmology *CP, const double asmth, const int isFirstTimeStep) |
void | update_lastactive_drift (DriftKickTimes *times) |
void | apply_half_kick (const ActiveParticles *act, Cosmology *CP, DriftKickTimes *times, const double atime, const double MinEgySpec) |
void | apply_PM_half_kick (Cosmology *CP, DriftKickTimes *times) |
static double | get_timestep_dloga (const int p, const inttime_t Ti_Current, const double atime, const double hubble, enum TimeStepType *titype) |
double | get_long_range_timestep_dloga (const double atime, const Cosmology *CP, const int FastParticleType, const double asmth) |
inttime_t | find_next_kick (inttime_t Ti_Current, int minTimeBin) |
static void | print_timebin_statistics (const DriftKickTimes *const times, const int NumCurrentTiStep, int *TimeBinCountType, const double Time) |
int | rebuild_activelist (ActiveParticles *act, const DriftKickTimes *const times, int NumCurrentTiStep, const double Time) |
void | free_activelist (ActiveParticles *act) |
Variables | |
static struct timestep_params | TimestepParams |
routines for 'kicking' particles in momentum space and assigning new timesteps
Definition in file timestep.c.
enum TimeStepType |
Enumerator | |
---|---|
TI_ACCEL | |
TI_COURANT | |
TI_ACCRETE | |
TI_NEIGH | |
TI_HSML |
Definition at line 106 of file timestep.c.
void apply_half_kick | ( | const ActiveParticles * | act, |
Cosmology * | CP, | ||
DriftKickTimes * | times, | ||
const double | atime, | ||
const double | MinEgySpec | ||
) |
Definition at line 323 of file timestep.c.
References CP, dloga_from_dti(), do_the_short_range_kick(), dti_from_timebin(), endrun(), get_active_particle(), get_exact_gravkick_factor(), get_exact_hydrokick_factor(), is_timebin_active(), DriftKickTimes::maxtimebin, DriftKickTimes::mintimebin, ActiveParticles::NumActiveParticle, P, DriftKickTimes::Ti_Current, DriftKickTimes::Ti_kick, TIMEBINS, and walltime_measure.
Referenced by run().
void apply_PM_half_kick | ( | Cosmology * | CP, |
DriftKickTimes * | times | ||
) |
Definition at line 373 of file timestep.c.
References CP, get_exact_gravkick_factor(), GravPM, part_manager_type::NumPart, P, PartManager, DriftKickTimes::PM_kick, DriftKickTimes::PM_length, and walltime_measure.
Referenced by run().
|
static |
Definition at line 396 of file timestep.c.
References BHP, GAMMA_MINUS1, timestep_params::MaxGasVel, message(), P, SPHP, and TimestepParams.
Referenced by apply_half_kick().
This function finds the next synchronization point of the system (i.e. the earliest point of time any of the particles needs a force computation), and drifts the system to this point of time. If the system drifts over the desired time of a snapshot file, the function will drift to this moment, generate an output, and then resume the drift.
Definition at line 712 of file timestep.c.
References dti_from_timebin().
Referenced by run().
int find_timesteps | ( | const ActiveParticles * | act, |
DriftKickTimes * | times, | ||
const double | atime, | ||
int | FastParticleType, | ||
const Cosmology * | CP, | ||
const double | asmth, | ||
const int | isFirstTimeStep | ||
) |
Definition at line 176 of file timestep.c.
References CP, dloga_from_dti(), dti_from_timebin(), timestep_params::ForceEqualTimesteps, get_active_particle(), get_PM_timestep_ti(), get_timestep_bin(), get_timestep_ti(), hubble_function(), is_PM_timestep(), is_timebin_active(), timestep_params::MaxSizeTimestep, DriftKickTimes::maxtimebin, message(), DriftKickTimes::mintimebin, MPI_INT64, ActiveParticles::NumActiveParticle, part_manager_type::NumPart, P, PartManager, DriftKickTimes::PM_kick, DriftKickTimes::PM_length, DriftKickTimes::PM_start, round_down_power_of_two(), TI_ACCEL, TI_ACCRETE, TI_COURANT, DriftKickTimes::Ti_Current, TI_HSML, TI_NEIGH, TIMEBASE, TIMEBINS, TimestepParams, and walltime_measure.
Referenced by run().
void free_activelist | ( | ActiveParticles * | act | ) |
Definition at line 795 of file timestep.c.
References ActiveParticles::ActiveParticle, event_unlisten(), EventSlotsFork, myfree, and timestep_eh_slots_fork().
Referenced by run().
|
inlinestatic |
Definition at line 68 of file timestep.c.
References ActiveParticles::ActiveParticle.
Referenced by apply_half_kick(), and find_timesteps().
double get_atime | ( | const inttime_t | Ti_Current | ) |
Definition at line 168 of file timestep.c.
References loga_from_ti().
Referenced by run().
double get_long_range_timestep_dloga | ( | const double | atime, |
const Cosmology * | CP, | ||
const int | FastParticleType, | ||
const double | asmth | ||
) |
This function computes the PM timestep of the system based on the rms velocities of particles. For cosmological simulations, the criterion used is that the rms displacement should be at most a fraction MaxRMSDisplacementFac of the mean particle separation. Note that the latter is estimated using the assigned particle masses, separately for each particle type.
Definition at line 584 of file timestep.c.
References count_sum(), CP, dloga, DMIN, get_omega_nu(), Cosmology::GravInternal, Cosmology::Hubble, hubble_function(), timestep_params::MaxRMSDisplacementFac, timestep_params::MaxSizeTimestep, message(), timestep_params::MinSizeTimestep, part_manager_type::NumPart, Cosmology::OmegaBaryon, Cosmology::OmegaCDM, Cosmology::ONu, P, PartManager, sumup_large_ints(), and TimestepParams.
Referenced by get_PM_timestep_ti().
|
static |
Definition at line 667 of file timestep.c.
References CP, dloga, dti_from_dloga(), endrun(), find_next_sync_point(), get_long_range_timestep_dloga(), DriftKickTimes::PM_kick, round_down_power_of_two(), SyncPoint::ti, and DriftKickTimes::Ti_Current.
Referenced by find_timesteps().
|
static |
Definition at line 686 of file timestep.c.
Referenced by find_timesteps().
|
static |
Definition at line 450 of file timestep.c.
References BHP, timestep_params::CourantFac, dloga, timestep_params::ErrTolIntAccuracy, FORCE_SOFTENING(), GAMMA, get_dloga_for_bin(), P, SPHP, TI_ACCEL, TI_ACCRETE, TI_COURANT, TI_HSML, TI_NEIGH, TIMEBINS, and TimestepParams.
Referenced by get_timestep_ti().
|
static |
This function returns the maximum allowed timestep of a particle, expressed in terms of the integer mapping that is used to represent the total simulated timespan. Arguments: p -> particle index dti_max -> maximal timestep.
Definition at line 537 of file timestep.c.
References dloga, dti_from_dloga(), get_timestep_dloga(), GravPM, message(), timestep_params::MinSizeTimestep, P, SPHP, TIMEBASE, and TimestepParams.
Referenced by find_timesteps().
DriftKickTimes init_driftkicktime | ( | inttime_t | Ti_Current | ) |
Definition at line 133 of file timestep.c.
References DriftKickTimes::PM_kick, DriftKickTimes::PM_length, DriftKickTimes::PM_start, DriftKickTimes::Ti_Current, DriftKickTimes::Ti_kick, DriftKickTimes::Ti_lastactivedrift, and TIMEBINS.
Referenced by run(), run_gravity_test(), runfof(), setup_density_indep_entropy(), and setup_smoothinglengths().
inttime_t init_timebins | ( | double | TimeInit | ) |
Definition at line 123 of file timestep.c.
References message(), and ti_from_loga().
Referenced by init().
int is_PM_timestep | ( | const DriftKickTimes *const | times | ) |
Definition at line 160 of file timestep.c.
References endrun(), DriftKickTimes::PM_length, DriftKickTimes::PM_start, and DriftKickTimes::Ti_Current.
Referenced by find_timesteps(), print_timebin_statistics(), rebuild_activelist(), and run().
int is_timebin_active | ( | int | i, |
inttime_t | current | ||
) |
Definition at line 149 of file timestep.c.
References dti_from_timebin().
Referenced by apply_half_kick(), find_timesteps(), hydro_force(), print_timebin_statistics(), rebuild_activelist(), run(), timestep_eh_slots_fork(), and update_lastactive_drift().
|
static |
This routine writes one line for every timestep. FdCPU the cumulative cpu-time consumption in various parts of the code is stored.
Definition at line 807 of file timestep.c.
References dloga, get_dloga_for_bin(), is_PM_timestep(), is_timebin_active(), message(), DriftKickTimes::mintimebin, ptype, sumup_large_ints(), DriftKickTimes::Ti_Current, TIMEBINS, and TotNumPart.
Referenced by rebuild_activelist().
int rebuild_activelist | ( | ActiveParticles * | act, |
const DriftKickTimes *const | times, | ||
int | NumCurrentTiStep, | ||
const double | Time | ||
) |
Definition at line 721 of file timestep.c.
References ActiveParticles::ActiveParticle, endrun(), event_listen(), EventSlotsFork, gadget_compact_thread_arrays(), gadget_setup_thread_arrays(), is_PM_timestep(), is_timebin_active(), ActiveParticles::MaxActiveParticle, part_manager_type::MaxPart, myfree, mymalloc, myrealloc, ActiveParticles::NumActiveParticle, part_manager_type::NumPart, P, PartManager, print_timebin_statistics(), ta_free, ta_malloc, DriftKickTimes::Ti_Current, TIMEBINS, timestep_eh_slots_fork(), and walltime_measure.
Referenced by run(), and run_gravity_test().
void set_timestep_params | ( | ParameterSet * | ps | ) |
Definition at line 51 of file timestep.c.
References timestep_params::CourantFac, timestep_params::ErrTolIntAccuracy, timestep_params::ForceEqualTimesteps, timestep_params::MaxGasVel, timestep_params::MaxRMSDisplacementFac, timestep_params::MaxSizeTimestep, timestep_params::MinSizeTimestep, param_get_double(), param_get_int(), ThisTask, and TimestepParams.
Referenced by read_parameter_file().
|
static |
Definition at line 77 of file timestep.c.
References ActiveParticles::ActiveParticle, atomic_fetch_and_add_64(), EISlotsFork::child, endrun(), is_timebin_active(), ActiveParticles::MaxActiveParticle, ActiveParticles::NumActiveParticle, P, and EISlotsFork::parent.
Referenced by free_activelist(), and rebuild_activelist().
void update_lastactive_drift | ( | DriftKickTimes * | times | ) |
Definition at line 309 of file timestep.c.
References is_timebin_active(), DriftKickTimes::Ti_Current, DriftKickTimes::Ti_lastactivedrift, and TIMEBINS.
Referenced by run().
|
static |