GADGET-4
sim Class Reference

#include <simulation.h>

Inherits pinning, and test_io_bandwidth.

Public Member Functions

 sim (MPI_Comm comm)
 
void rearrange_lightcone (int argc, char **argv)
 
void rearrange_snapshot (int argc, char **argv)
 
template<typename partset >
void rearrange_generic (partset &Tp, int conenr, int firstnr, int lastnr)
 
template<typename partset >
void rearrange_fill_treetable (partset &Tp)
 
template<typename partset >
void rearrange_read (partset &Tp, int num, int conenr)
 
template<typename partset >
void rearrange_write (partset &Tp, int num, int conenr)
 
void hello (void)
 
void endrun (void)
 This function aborts the simulations. More...
 
void begrun1 (const char *parameterFile)
 This function performs the initial set-up of the simulation. More...
 
void begrun2 (void)
 This function does late setup, after the IC file has been loaded but before run() is called. More...
 
void init (int RestartSnapNum)
 Prepares the loaded initial conditions for the run. More...
 
void run (void)
 
void set_units (void)
 Computes conversion factors between internal code units and the cgs-system. More...
 
void create_snapshot_if_desired (void)
 Check if a snapshot should be saved. More...
 
void healthtest (void)
 
void mpi_report_comittable_memory (void)
 
long long report_comittable_memory (long long *MemTotal, long long *Committed_AS, long long *SwapTotal, long long *SwapFree)
 
long long report_free_size_in_tmpfs (void)
 
void do_gravity_step_second_half (void)
 performs the second gravity half step kick operator More...
 
void find_timesteps_and_do_gravity_step_first_half (void)
 performs the first half step kick operator for the gravity More...
 
void do_hydro_step_first_half (void)
 
void do_hydro_step_second_half (void)
 
void find_global_timesteps (void)
 
void find_hydro_timesteps (void)
 
void gravity (int timebin)
 main driver routine of gravity tree/fmm force calculation More...
 
void gravity_long_range_force (void)
 
void gravity_comoving_factors (int timebin)
 
void gravity_pm (int timebin)
 
void gravity_set_oldacc (int timebin)
 
void hydro_force (int step_indicator)
 
void compute_grav_accelerations (int timebin)
 This routine computes the gravitational accelerations for all active particles. More...
 
- Public Member Functions inherited from pinning
void get_core_set (void)
 
void detect_topology (void)
 
void pin_to_core_set (setcomm *sc)
 
void report_pinning (setcomm *sc)
 
- Public Member Functions inherited from test_io_bandwidth
 test_io_bandwidth (MPI_Comm comm)
 
void measure_io_bandwidth (void)
 
- Public Member Functions inherited from io_streamcount
size_t my_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream)
 A wrapper for the fwrite() function. More...
 
size_t my_fread (void *ptr, size_t size, size_t nmemb, FILE *stream)
 A wrapper for the fread() function. More...
 
void reset_io_byte_count (void)
 
long long get_io_byte_count (void)
 
- Public Member Functions inherited from setcomm
 setcomm (MPI_Comm Comm)
 
 setcomm (const char *str)
 
void initcomm (MPI_Comm Comm)
 
void mpi_printf (const char *fmt,...)
 
void determine_compute_nodes (void)
 

Public Attributes

simparticles Sp {Communicator}
 
domain< simparticlesDomain {Communicator, &Sp}
 
gwalk GravTree
 
sph NgbTree
 
- Public Attributes inherited from io_streamcount
long long byte_count = 0
 
- Public Attributes inherited from setcomm
MPI_Comm Communicator
 
int NTask
 
int ThisTask
 
int PTask
 
int ThisNode
 
int NumNodes = 0
 
int TasksInThisNode
 
int RankInThisNode
 
int MinTasksPerNode
 
int MaxTasksPerNode
 
long long MemoryOnNode
 
long long SharedMemoryOnNode
 

Detailed Description

Definition at line 49 of file simulation.h.

Constructor & Destructor Documentation

◆ sim()

sim ( MPI_Comm  comm)
inline

Definition at line 52 of file simulation.h.

Member Function Documentation

◆ begrun1()

void begrun1 ( const char *  parameterFile)

This function performs the initial set-up of the simulation.

First, the parameter file is read by read_parameter_file(), then routines for setting units, etc are called. This function only does the setup necessary to load the IC file. After the IC file has been loaded and prepared by init(), setup continues with begrun2(). This splitting is done so that we can return cleanly from operations that don't actually start the simulation (converting snapshots, making projected images, etc.)

Definition at line 130 of file begrun.cc.

◆ begrun2()

void begrun2 ( void  )

This function does late setup, after the IC file has been loaded but before run() is called.

The output files are opened and various modules are initialized. The next output time is determined by find_next_outputtime() and various timers are set.

Definition at line 262 of file begrun.cc.

◆ compute_grav_accelerations()

void compute_grav_accelerations ( int  timebin)

This routine computes the gravitational accelerations for all active particles.

If the particle mesh is used and the current time step requires a PM force computation, new long range forces are computed by long_range_force(). Then the shortrange tree forces are computed by gravity(). The force tree is rebuild every time step.

Definition at line 41 of file gravity.cc.

◆ create_snapshot_if_desired()

void create_snapshot_if_desired ( void  )

Check if a snapshot should be saved.

This function checks whether a snapshot file or other kinds of output files, such as a projection, should be saved at the current time-step. If that is the case, the appropriate functions to produce the desired file are called and the parameter controlling the output are updated accordingly.

Definition at line 507 of file run.cc.

◆ do_gravity_step_second_half()

void do_gravity_step_second_half ( void  )

performs the second gravity half step kick operator

This function applies a half step kick similar to do_gravity_step_first_half(). First the short range kick due to the tree force is added. If we are on a PM step the kick due to the particle mesh's long range gravity is applied too. In both cases the momentum and energy for Sph particles is updated.

Definition at line 274 of file kicks.cc.

◆ do_hydro_step_first_half()

void do_hydro_step_first_half ( void  )

Definition at line 449 of file kicks.cc.

◆ do_hydro_step_second_half()

void do_hydro_step_second_half ( void  )

Definition at line 469 of file kicks.cc.

◆ endrun()

void endrun ( void  )

This function aborts the simulations.

This method has to be called by all processes. It should be used only if the simulation ends without a errors or a an error message is already printed. Otherwise Terminate() should be used instead.

Definition at line 395 of file begrun.cc.

◆ find_global_timesteps()

void find_global_timesteps ( void  )

◆ find_hydro_timesteps()

void find_hydro_timesteps ( void  )

This function advances the system in momentum space, i.e. it does apply the 'kick' operation after the forces have been computed. Additionally, it assigns new timesteps to particles. At start-up, a half-timestep is carried out, as well as at the end of the simulation. In between, the half-step kick that ends the previous timestep and the half-step kick for the new timestep are combined into one operation.

Definition at line 39 of file timestep.cc.

◆ find_timesteps_and_do_gravity_step_first_half()

void find_timesteps_and_do_gravity_step_first_half ( void  )

performs the first half step kick operator for the gravity

This function applies a half step kick similar to do_gravity_step_second_half(). If we are on a PM step the kick due to the particle mesh's long range gravity is applied first. Afterwards the short range kick due to the tree force is added.

Definition at line 40 of file kicks.cc.

◆ gravity()

void gravity ( int  timebin)

main driver routine of gravity tree/fmm force calculation

This routine handles the whole tree force calculation. First it builds a new force tree force_treebuild() every timestep. This tree is then used to calculate a new tree force for every active particle ( gravity_tree() ). The passed variable 'timebin' is only used to inform about the largest timebin of the particles in the list of active particles.

The tree will be constructed for the NActiveGravity particles listed in the array ActiveActiveGravityParticles[]

Definition at line 171 of file gravity.cc.

◆ gravity_comoving_factors()

void gravity_comoving_factors ( int  timebin)

Definition at line 277 of file gravity.cc.

◆ gravity_long_range_force()

void gravity_long_range_force ( void  )

◆ gravity_pm()

void gravity_pm ( int  timebin)

◆ gravity_set_oldacc()

void gravity_set_oldacc ( int  timebin)

Definition at line 248 of file gravity.cc.

◆ healthtest()

void healthtest ( void  )

Definition at line 36 of file healthtest.cc.

◆ hello()

void hello ( void  )

This file contains various functions to initialize a simulation run. In particular, the parameter file is read in and parsed and global variables are initialized to their proper values.

Definition at line 58 of file begrun.cc.

◆ hydro_force()

void hydro_force ( int  step_indicator)

This function is the driver routine for the calculation of hydrodynamical force and rate of change of entropy due to shock heating for all active particles .

Definition at line 480 of file kicks.cc.

◆ init()

void init ( int  RestartSnapNum)

Prepares the loaded initial conditions for the run.

It is only called if RestartFlag != RST_RESUME. Various counters and variables are initialized. Entries of the particle data structures not read from initial conditions are initialized or converted and a initial domain decomposition is performed. If SPH particles are present, the initial SPH smoothing lengths are determined.

Definition at line 51 of file init.cc.

◆ mpi_report_comittable_memory()

void mpi_report_comittable_memory ( void  )

Definition at line 215 of file system.cc.

◆ rearrange_fill_treetable()

void rearrange_fill_treetable ( partset &  Tp)

◆ rearrange_generic()

void rearrange_generic ( partset &  Tp,
int  conenr,
int  firstnr,
int  lastnr 
)

◆ rearrange_lightcone()

void rearrange_lightcone ( int  argc,
char **  argv 
)

◆ rearrange_read()

void rearrange_read ( partset &  Tp,
int  num,
int  conenr 
)

◆ rearrange_snapshot()

void rearrange_snapshot ( int  argc,
char **  argv 
)

◆ rearrange_write()

void rearrange_write ( partset &  Tp,
int  num,
int  conenr 
)

◆ report_comittable_memory()

long long report_comittable_memory ( long long *  MemTotal,
long long *  Committed_AS,
long long *  SwapTotal,
long long *  SwapFree 
)

Definition at line 167 of file system.cc.

◆ report_free_size_in_tmpfs()

long long report_free_size_in_tmpfs ( void  )

Definition at line 203 of file system.cc.

◆ run()

void run ( void  )

Main driver routine for advancing the simulation forward in time. The loop terminates when the cpu-time limit is reached, when a ‘stop’ file is found in the output directory, or when the simulation ends because we arrived at TimeMax.

If the simulation is started from initial conditions, an initial domain decomposition is performed, the gravitational forces are computed and initial hydro forces are calculated.

Definition at line 49 of file run.cc.

◆ set_units()

void set_units ( void  )

Computes conversion factors between internal code units and the cgs-system.

In addition constants like the gravitation constant are set.

Definition at line 335 of file begrun.cc.

Member Data Documentation

◆ Domain

Definition at line 58 of file simulation.h.

◆ GravTree

gwalk GravTree

Definition at line 65 of file simulation.h.

◆ NgbTree

sph NgbTree

Definition at line 68 of file simulation.h.

◆ Sp

Definition at line 56 of file simulation.h.


The documentation for this class was generated from the following files: