Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

run.c File Reference

iterates over timesteps, main loop More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <mpi.h>
#include <unistd.h>
#include "allvars.h"
#include "proto.h"

Go to the source code of this file.

Functions

void run (void)
void find_next_sync_point_and_drift (void)
int find_next_outputtime (int ti_curr)
void every_timestep_stuff (void)
void energy_statistics (void)


Detailed Description

iterates over timesteps, main loop

Definition in file run.c.


Function Documentation

void energy_statistics void   ) 
 

This routine first calls a computation of various global quantities of the particle distribution, and then writes some statistics about the energies in the various particle components to the file FdEnergy.

Definition at line 417 of file run.c.

References All, state_of_system::EnergyInt, state_of_system::EnergyIntComp, state_of_system::EnergyKin, state_of_system::EnergyKinComp, state_of_system::EnergyPot, state_of_system::EnergyPotComp, FdEnergy, state_of_system::MassComp, SysState, ThisTask, and global_data_all_processes::Time.

Referenced by run().

void every_timestep_stuff void   ) 
 

This routine writes one line for every timestep to two log-files. In FdInfo, we just list the timesteps that have been done, while in FdCPU the cumulative cpu-time consumption in various parts of the code is stored.

Definition at line 374 of file run.c.

References All, global_data_all_processes::ComovingIntegrationOn, global_data_all_processes::CPU_CommSum, global_data_all_processes::CPU_Domain, global_data_all_processes::CPU_EnsureNgb, global_data_all_processes::CPU_Gravity, global_data_all_processes::CPU_HydCommSumm, global_data_all_processes::CPU_HydCompWalk, global_data_all_processes::CPU_HydImbalance, global_data_all_processes::CPU_Hydro, global_data_all_processes::CPU_Imbalance, global_data_all_processes::CPU_Peano, global_data_all_processes::CPU_PM, global_data_all_processes::CPU_Potential, global_data_all_processes::CPU_Predict, global_data_all_processes::CPU_Snapshot, global_data_all_processes::CPU_TimeLine, global_data_all_processes::CPU_Total, global_data_all_processes::CPU_TreeConstruction, global_data_all_processes::CPU_TreeWalk, FdCPU, FdInfo, NTask, global_data_all_processes::NumCurrentTiStep, ThisTask, global_data_all_processes::Time, and global_data_all_processes::TimeStep.

Referenced by run().

int find_next_outputtime int  ti_curr  ) 
 

this function returns the next output time that is equal or larger to ti_curr

< The simulated timespan is mapped onto the integer interval [0,TIMESPAN], where TIMESPAN needs to be a power of 2. Note that (1<<28) corresponds to 2^29

Definition at line 246 of file run.c.

References All, global_data_all_processes::ComovingIntegrationOn, global_data_all_processes::OutputListLength, global_data_all_processes::OutputListTimes, global_data_all_processes::Timebase_interval, global_data_all_processes::TimeBegin, and global_data_all_processes::TimeMax.

Referenced by begrun().

void find_next_sync_point_and_drift void   ) 
 

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 153 of file run.c.

References All, Flag_FullStep, and P.

Referenced by run().

void run void   ) 
 

This routine contains the main simulation loop that iterates over single timesteps. 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.

< The simulated timespan is mapped onto the integer interval [0,TIMESPAN], where TIMESPAN needs to be a power of 2. Note that (1<<28) corresponds to 2^29

Definition at line 20 of file run.c.

References advance_and_find_timesteps(), All, close_outputfiles(), compute_accelerations(), compute_potential(), global_data_all_processes::CPU_Total, CPUThisRun, global_data_all_processes::CpuTimeBetRestartFile, domain_Decomposition(), energy_statistics(), every_timestep_stuff(), find_next_sync_point_and_drift(), global_data_all_processes::NumCurrentTiStep, global_data_all_processes::OutputDir, restart(), global_data_all_processes::ResubmitCommand, global_data_all_processes::ResubmitOn, savepositions(), second(), global_data_all_processes::SnapshotFileCount, ThisTask, global_data_all_processes::Ti_Current, global_data_all_processes::Time, TIMEBASE, global_data_all_processes::TimeBetStatistics, timediff(), global_data_all_processes::TimeLastRestartFile, global_data_all_processes::TimeLastStatistics, global_data_all_processes::TimeLimitCPU, and global_data_all_processes::TimeMax.

Referenced by main().


Generated on Sun May 22 17:33:30 2005 for GADGET-2 by  doxygen 1.3.9.1