MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MD Class Reference

A class that defines and solves a MD problem. More...

#include <MD.h>

+ Inheritance diagram for MD:

Public Member Functions

void constructor ()
 A public constructor, which sets defaults so the problem can be solved off the shelf. More...
 
 MD ()
 
 MD (STD_save &other)
 
virtual ~MD ()
 
void info ()
 Set up a virtual info this will be provided from the inhertiance. More...
 
void solve ()
 The work horse of the code. More...
 
void solve (unsigned int argc, char *argv[])
 Read arguments before solving. More...
 
void solveWithMDCLR ()
 Tries to solve the problem using MDCLR. More...
 
Mdouble get_t ()
 Access function for the time. More...
 
void set_t (Mdouble new_t)
 Access function for the time. More...
 
int get_NSpecies ()
 Allows the number of Species to be accessed. More...
 
std::vector< CSpecies > & get_Species (void)
 Allows the species to be copied. More...
 
CSpeciesget_Species (int i)
 Allows the species to be accessed. More...
 
CSpeciesget_MixedSpecies (int i, int j)
 Allows the mixed species to be accessed. More...
 
void set_MixedSpecies (int i, int j, CSpecies &S)
 Allows the mixed species to be set. More...
 
void set_tmax (Mdouble new_tmax)
 Allows the upper time limit to be changed. More...
 
Mdouble get_tmax ()
 Allows the upper time limit to be accessed. More...
 
ParticleHandlergetParticleHandler ()
 
WallHandlergetWallHandler ()
 
BoundaryHandlergetBoundaryHandler ()
 
void set_savecount (int new_)
 Allows the number of time steps between saves to be changed, see also set_number_of_saves. More...
 
void set_save_count_all (int new_)
 
void set_save_count_data (int new_)
 
void set_save_count_ene (int new_)
 
void set_save_count_stat (int new_)
 
void set_save_count_fstat (int new_)
 
int get_savecount ()
 Allows the number of time steps between saves to be accessed. More...
 
int get_save_count ()
 
int get_save_count_data ()
 
int get_save_count_ene ()
 
int get_save_count_stat ()
 
int get_save_count_fstat ()
 
void set_do_stat_always (bool new_)
 Sets how often the data is saved using the number of saves wanted, tmax, and dt. See also set_savecount. More...
 
void set_number_of_saves (Mdouble N)
 
void set_number_of_saves_all (Mdouble N)
 
void set_number_of_saves_data (Mdouble N)
 
void set_number_of_saves_ene (Mdouble N)
 
void set_number_of_saves_stat (Mdouble N)
 
void set_number_of_saves_fstat (Mdouble N)
 
void set_plastic_k1_k2max_kc_depth (Mdouble k1_, Mdouble k2max_, Mdouble kc_, Mdouble depth_, unsigned int indSpecies=0)
 Allows the plastic constants to be changed. More...
 
void set_k1 (Mdouble new_, unsigned int indSpecies=0)
 
void set_k2max (Mdouble new_, unsigned int indSpecies=0)
 
void set_kc (Mdouble new_, unsigned int indSpecies=0)
 
void set_depth (Mdouble new_, unsigned int indSpecies=0)
 
Mdouble get_k1 (unsigned int indSpecies=0)
 Allows the plastic constants to be accessed. More...
 
Mdouble get_k2max (unsigned int indSpecies=0)
 
Mdouble get_kc (unsigned int indSpecies=0)
 
Mdouble get_depth (unsigned int indSpecies=0)
 
Mdouble get_plastic_dt (Mdouble mass, unsigned int indSpecies=0)
 
void set_k (Mdouble new_, unsigned int indSpecies=0)
 Allows the spring constant to be changed. More...
 
Mdouble get_k (int indSpecies=0)
 Allows the spring constant to be accessed. More...
 
void set_kt (Mdouble new_, unsigned int indSpecies=0)
 Allows the spring constant to be changed. More...
 
Mdouble get_kt (int indSpecies=0)
 Allows the spring constant to be accessed. More...
 
void set_krolling (Mdouble new_, unsigned int indSpecies=0)
 Allows the spring constant to be changed. More...
 
Mdouble get_krolling (int indSpecies=0)
 Allows the spring constant to be accessed. More...
 
void set_ktorsion (Mdouble new_, unsigned int indSpecies=0)
 Allows the spring constant to be changed. More...
 
Mdouble get_ktorsion (int indSpecies=0)
 Allows the spring constant to be accessed. More...
 
void set_rho (Mdouble new_, unsigned int indSpecies=0)
 Allows the density to be changed. More...
 
Mdouble get_rho (int indSpecies=0)
 Allows the density to be accessed. More...
 
void set_dispt (Mdouble new_, unsigned int indSpecies=0)
 Allows the tangential viscosity to be changed. More...
 
Mdouble get_dispt (unsigned int indSpecies=0)
 Allows the tangential viscosity to be accessed. More...
 
void set_disprolling (Mdouble new_, unsigned int indSpecies=0)
 Allows the tangential viscosity to be changed. More...
 
Mdouble get_disprolling (unsigned int indSpecies=0)
 Allows the tangential viscosity to be accessed. More...
 
void set_disptorsion (Mdouble new_, unsigned int indSpecies=0)
 Allows the tangential viscosity to be changed. More...
 
Mdouble get_disptorsion (unsigned int indSpecies=0)
 Allows the tangential viscosity to be accessed. More...
 
void set_disp (Mdouble new_, unsigned int indSpecies=0)
 Allows the normal dissipation to be changed. More...
 
Mdouble get_disp (unsigned int indSpecies=0)
 Allows the normal dissipation to be accessed. More...
 
void set_dissipation (Mdouble new_, unsigned int indSpecies=0)
 Allows the normal dissipation to be changed. More...
 
Mdouble get_dissipation (unsigned int indSpecies=0)
 Allows the normal dissipation to be accessed. More...
 
void set_mu (Mdouble new_, unsigned int indSpecies=0)
 Allows the Coulomb friction coefficient to be changed. More...
 
Mdouble get_mu (unsigned int indSpecies=0)
 Allows the Coulomb friction coefficient to be accessed. More...
 
void set_murolling (Mdouble new_, unsigned int indSpecies=0)
 Allows the Coulomb friction coefficient to be changed. More...
 
Mdouble get_murolling (unsigned int indSpecies=0)
 Allows the Coulomb friction coefficient to be accessed. More...
 
void set_mutorsion (Mdouble new_, unsigned int indSpecies=0)
 Allows the Coulomb friction coefficient to be changed. More...
 
Mdouble get_mutorsion (unsigned int indSpecies=0)
 Allows the Coulomb friction coefficient to be accessed. More...
 
void set_rotation (bool new_)
 
bool get_rotation ()
 
void set_dim_particle (int new_, unsigned int indSpecies=0)
 Allows the dimension of the particle (f.e. for mass) to be changed. More...
 
int get_dim_particle (unsigned int indSpecies=0)
 Allows the dimension of the particle (f.e. for mass) to be accessed. More...
 
bool get_save_data_data ()
 Returns the data counter. More...
 
bool get_save_data_ene ()
 
bool get_save_data_fstat ()
 
bool get_save_data_stat ()
 
bool get_do_stat_always ()
 
void set_k_and_restitution_coefficient (Mdouble k_, Mdouble eps, Mdouble mass, unsigned int indSpecies=0)
 Sets k, disp such that it matches a given tc and eps for a collision of two copies of P. More...
 
void set_collision_time_and_restitution_coefficient (Mdouble tc, Mdouble eps, Mdouble mass, unsigned int indSpecies=0)
 Sets k, disp such that it matches a given tc and eps for a collision of two copies of P. More...
 
void set_collision_time_and_restitution_coefficient (Mdouble tc, Mdouble eps, Mdouble mass1, Mdouble mass2, unsigned int indSpecies=0)
 Set k, disp such that is matches a given tc and eps for a collision of two different masses. More...
 
void set_collision_time_and_normal_and_tangential_restitution_coefficient (Mdouble tc, Mdouble eps, Mdouble beta, Mdouble mass1, Mdouble mass2, unsigned int indSpecies=0)
 See CSpecies::set_collision_time_and_normal_and_tangential_restitution_coefficient. More...
 
void set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt (Mdouble tc, Mdouble eps, Mdouble beta, Mdouble mass1, Mdouble mass2, unsigned int indSpecies=0)
 See CSpecies::set_collision_time_and_normal_and_tangential_restitution_coefficient. More...
 
Mdouble get_collision_time (Mdouble mass, unsigned int indSpecies=0)
 Calculates collision time for two copies of a particle of given disp, k, mass. More...
 
Mdouble get_restitution_coefficient (Mdouble mass, unsigned int indSpecies=0)
 Calculates restitution coefficient for two copies of given disp, k, mass. More...
 
Mdouble get_xmin ()
 Get xmin. More...
 
Mdouble get_xmax ()
 Get xmax. More...
 
Mdouble get_ymin ()
 Gets ymin. More...
 
Mdouble get_ymax ()
 Gets ymax. More...
 
Mdouble get_zmin ()
 Gets zmin. More...
 
Mdouble get_zmax ()
 Gets zmax. More...
 
void set_xmin (Mdouble new_xmin)
 Sets xmin and walls, assuming the standard definition of walls as in the default constructor. More...
 
void set_ymin (Mdouble new_ymin)
 
void set_zmin (Mdouble new_zmin)
 Sets ymin and walls, assuming the standard definition of walls as in the default constructor. More...
 
void set_xmax (Mdouble new_xmax)
 Sets xmax and walls, assuming the standard definition of walls as in the default constructor. More...
 
void set_ymax (Mdouble new_ymax)
 Sets ymax and walls, assuming the standard definition of walls as in the default constructor. More...
 
void set_zmax (Mdouble new_zmax)
 Sets ymax and walls, assuming the standard definition of walls as in the default constructor. More...
 
void set_dt (Mdouble new_dt)
 Allows the time step dt to be changed. More...
 
Mdouble get_dt ()
 Allows the time step dt to be accessed. More...
 
void set_name (const char *name)
 Sets the name of the problem, used for the same data files. More...
 
void set_xballs_colour_mode (int new_cmode)
 Set the xball output mode. More...
 
void set_xballs_cmode (int new_cmode)
 
int get_xballs_cmode ()
 
void set_xballs_vector_scale (double new_vscale)
 Set the scale of vectors in xballs. More...
 
double get_xballs_vscale ()
 
void set_xballs_additional_arguments (std::string new_)
 Set the additional arguments for xballs. More...
 
std::string get_xballs_additional_arguments ()
 
void set_xballs_scale (Mdouble new_scale)
 Set the scale of the xballs problem. The default is fit to screen. More...
 
double get_xballs_scale ()
 
void set_gravity (Vec3D new_gravity)
 Allows the gravitational acceleration to be changed. More...
 
Vec3D get_gravity ()
 Allows the gravitational acceleration to be accessed. More...
 
void set_dim (int new_dim)
 Allows the dimension of the simulation to be changed. More...
 
int get_dim ()
 Allows the dimension of the simulation to be accessed. More...
 
int get_restart_version ()
 Gets restart_version. More...
 
void set_restart_version (int new_)
 Sets restart_version. More...
 
bool get_restarted ()
 Gets restarted. More...
 
Mdouble get_max_radius ()
 Sets restarted. More...
 
void set_restarted (bool new_)
 
bool get_append ()
 Gets restarted. More...
 
void set_append (bool new_)
 Sets restarted. More...
 
Mdouble get_ene_ela ()
 Gets ene_ela. More...
 
void set_ene_ela (Mdouble new_)
 Sets ene_ela. More...
 
void add_ene_ela (Mdouble new_)
 Sets ene_ela. More...
 
void Remove_Particle (int IP)
 This function removes partice IP from the vector of particles by moving the last particle in the vector to the position if IP Also it checks if the moved Particle has any tangentialsspring-information, which needs to be moved to a different particle, because tangential spring information always needs to be stored in the real particle with highest particle index. More...
 
Mdouble get_Mass_from_Radius (Mdouble radius, int indSpecies=0)
 
Mdouble get_maximum_velocity (BaseParticle &P)
 Calculates the maximum velocity allowed for a collision of two copies of P (for higher velocities particles could pass through each other) More...
 
virtual BaseParticlegetSmallestParticle ()
 
virtual BaseParticlegetLargestParticle ()
 
virtual void removeParticle (int iP)
 
Mdouble get_maximum_velocity ()
 
void set_dt_by_mass (Mdouble mass)
 Sets dt to 1/50-th of the collision time for two particles of mass P. More...
 
void set_dt (BaseParticle &P)
 Sets dt to 1/50-th of the collision time for two copies of P. More...
 
void set_dt ()
 Sets dt to 1/50-th of the smallest possible collision time. More...
 
virtual void setup_particles_initial_conditions ()
 This function allows the initial conditions of the particles to be set, by default locations is random. More...
 
virtual void create_xballs_script ()
 This creates a scipt which can be used to load the xballs problem to display the data just generated. More...
 
virtual double getInfo (BaseParticle &P)
 Allows the user to set what is written into the info column in the data file. By default is store the Species ID number. More...
 
virtual void save_restart_data ()
 Stores all MD data. More...
 
int load_restart_data ()
 Loads all MD data. More...
 
int load_restart_data (std::string filename)
 
void statistics_from_restart_data (const char *name)
 Loads all MD data and plots statistics for all timesteps in the .data file. More...
 
virtual void write (std::ostream &os)
 Writes all MD data. More...
 
virtual void read (std::istream &is)
 Reads all MD data. More...
 
virtual void write_v1 (std::ostream &os)
 Writes all MD data. More...
 
virtual void read_v1 (std::istream &is)
 Reads all MD data. More...
 
virtual void read_v2 (std::istream &is)
 
bool load_from_data_file (const char *filename, unsigned int format=0)
 This allows particle data to be reloaded from data files. More...
 
bool load_par_ini_file (const char *filename)
 allows the user to read par.ini files (useful to read MDCLR files) More...
 
bool read_next_from_data_file (unsigned int format=0)
 by default format do not pass an argument; only specify format if you have to read a special format (f.e. dim=2, but format=14 (3d format)) More...
 
int read_dim_from_data_file ()
 
bool find_next_data_file (Mdouble tmin, bool verbose=true)
 
virtual void print (std::ostream &os, bool print_all=false)
 Outputs MD. More...
 
void add_Species (CSpecies &S)
 
void add_Species (void)
 
void set_format (int new_)
 
int get_format ()
 
int readArguments (unsigned int argc, char *argv[])
 Can interpret main function input arguments that are passed by the driver codes. More...
 
virtual int readNextArgument (unsigned int &i, unsigned int argc, char *argv[])
 
- Public Member Functions inherited from STD_save
 STD_save ()
 Default constructor: sets the counter to 0 (i.e. no number will be included). More...
 
 STD_save (STD_save &other)
 Copy constructor. More...
 
void constructor ()
 
void inc_counter_in_file ()
 Increament the counter value stored in the file_counter by 1 and store the new value. More...
 
int read_run_num_from_file ()
 Read rom the counter file the counter. More...
 
void set_counter_from_file ()
 Sets the counter based on the current number stored in the counter file. More...
 
void save_info_to_disk ()
 Saves the information generated by info to disk in a file. More...
 
void set_counter (int new_counter)
 This set the counter, overriding the defaults. More...
 
int get_counter ()
 This returns the current value of the counter. More...
 
bool FileExists (std::string strFilename)
 Function to check if a file exists, is used to check if a run has already need done. More...
 
void auto_number ()
 
std::vector< intget_numbers (int size_x, int size_y)
 This turns a counter into two indexs for doing parmater studies. The indexs run from 1:size_x and 1:size_y where as the study number starts at 0. More...
 
int launch_new (const char *name, bool quick=false)
 This launch a code from within this code. Please pass the name of the code to run. More...
 
void set_name (const char *name)
 Sets the name of the problem, used for the same data files. More...
 
std::string get_name ()
 Allows the problem_name to be accessed. More...
 
std::fstream & get_data_file ()
 Allows the problem_name to be accessed. More...
 
std::fstream & get_stat_file ()
 Allows the problem_name to be accessed. More...
 
std::fstream & get_fstat_file ()
 Allows the problem_name to be accessed. More...
 
std::fstream & get_ene_file ()
 Allows the problem_name to be accessed. More...
 
void set_fstat_filename (std::string filename)
 
void set_data_filename (std::string filename)
 
void set_stat_filename (std::string filename)
 
void set_ene_filename (std::string filename)
 
void set_fstat_filename ()
 
void set_data_filename ()
 
void set_stat_filename ()
 
void set_ene_filename ()
 
std::string get_fstat_filename ()
 
std::string get_data_filename ()
 
std::string get_stat_filename ()
 
std::string get_ene_filename ()
 
void set_step_size (unsigned int new_)
 
unsigned int get_step_size ()
 
void set_options_fstat (unsigned int new_)
 set and get for file options More...
 
unsigned int get_options_fstat (void)
 
void set_options_data (unsigned int new_)
 
unsigned int get_options_data (void)
 
void set_options_stat (unsigned int new_)
 
unsigned int get_options_stat (void)
 
void set_options_restart (unsigned int new_)
 
unsigned int get_options_restart (void)
 
void set_options_ene (unsigned int new_)
 
unsigned int get_options_ene (void)
 
bool open_file (std::fstream &file, std::string filename, unsigned int options, std::fstream::openmode mode)
 
bool open_fstat_file (std::fstream::openmode mode=std::fstream::out)
 
bool open_data_file (std::fstream::openmode mode=std::fstream::out)
 
bool open_stat_file (std::fstream::openmode mode=std::fstream::out)
 
bool open_ene_file (std::fstream::openmode mode=std::fstream::out)
 
bool open_counted_file (std::fstream &file, std::string filenameNoCount, std::fstream::openmode mode)
 opens file needed if data is written in multiple files More...
 
bool increase_counter_fstat (std::fstream::openmode mode)
 
bool increase_counter_data (std::fstream::openmode mode)
 
bool increase_counter_stat (std::fstream::openmode mode)
 
bool increase_counter_ene (std::fstream::openmode mode)
 
void set_file_counter (int new_)
 
int get_file_counter ()
 

Public Attributes

RNG random
 

Protected Member Functions

virtual void compute_all_forces ()
 This does the force computation. More...
 
virtual void compute_internal_forces (BaseParticle *i)
 Computes the forces between particles (internal in the sence that the sum over all these forces is zero i.e. fully modelled forces) More...
 
CTangentialSpringgetTangentialSpring (BaseParticle *PI, BaseParticle *PJ, BaseParticle *PJreal)
 
CTangentialSpringgetTangentialSpringWall (BaseParticle *pI, int w)
 
virtual void compute_internal_forces (BaseParticle *P1, BaseParticle *P2)
 Computes the forces between particles (internal in the sence that the sum over all these forces is zero i.e. fully modelled forces) More...
 
void compute_plastic_internal_forces (BaseParticle *P1, BaseParticle *P2)
 Computes plastic forces between particles. More...
 
virtual void compute_external_forces (BaseParticle *PI)
 This is were the computation of external forces takes place (e.g. gravity) More...
 
virtual void compute_walls (BaseParticle *PI)
 This is were the walls are. More...
 
Mdouble computeShortRangeForceWithWall (BaseParticle *pI, int wall, CSpecies *pSpecies, Mdouble dist)
 
Mdouble computeShortRangeForceWithParticle (BaseParticle *PI, BaseParticle *PJ, BaseParticle *PJreal, CSpecies *pSpecies, Mdouble dist)
 
virtual void actions_before_time_loop ()
 This is actions before the start of the main time loop. More...
 
virtual void HGRID_actions_before_time_loop ()
 This is actions before the start of the main time loop. More...
 
virtual void HGRID_actions_before_time_step ()
 This is action before the time step is started. More...
 
virtual void HGRID_InsertParticleToHgrid (BaseParticle *obj UNUSED)
 This is action before the time step is started. More...
 
virtual void HGRID_UpdateParticleInHgrid (BaseParticle *obj UNUSED)
 
virtual void HGRID_RemoveParticleFromHgrid (BaseParticle *obj UNUSED)
 
virtual bool get_HGRID_UpdateEachTimeStep ()
 
virtual void actions_before_time_step ()
 This is action before the time step is started. More...
 
virtual void actions_after_solve ()
 This is actions at the end of the code, but before the files are closed. More...
 
virtual void actions_after_time_step ()
 This is action after the time step is finished. More...
 
virtual void output_xballs_data ()
 Output xball data for Particle i. More...
 
virtual void output_xballs_data_particle (int i)
 This function outputs the location and velocity of the particle in a format the xballs progream can read. More...
 
virtual void start_ene ()
 Functions for ene file. More...
 
virtual void fstat_header ()
 
virtual void output_ene ()
 This function outputs statistical data - The default is to compute the rotational kinetic engergy, linear kinetic energy, and the centre of mass. More...
 
virtual void initialize_statistics ()
 Functions for statistics. More...
 
virtual void output_statistics ()
 
virtual void gather_statistics_collision (int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED)
 
virtual void process_statistics (bool usethese UNUSED)
 
virtual void finish_statistics ()
 
virtual void set_initial_pressures_for_pressure_controlled_walls ()
 
virtual void do_integration_before_force_computation (BaseParticle *pI)
 This is were the integration is done. More...
 
virtual void checkInteractionWithBoundaries ()
 
virtual void HGRID_update_move (BaseParticle *, Mdouble)
 
virtual void HGRID_actions_before_integration ()
 
virtual void HGRID_actions_after_integration ()
 
virtual void do_integration_after_force_computation (BaseParticle *pI)
 This is were the integration is done. More...
 
virtual void InitBroadPhase ()
 Initialisation of Broad Phase Information (Default no Broad Phase so empty) More...
 
virtual void broad_phase (BaseParticle *i)
 Broad phase of contact detection goes here. Default check all contacts. More...
 
void set_FixedParticles (unsigned int n)
 
void initialize_tangential_springs ()
 
void compute_particle_masses ()
 Computes the mass of each particle. More...
 
virtual void cout_time ()
 std::couts time More...
 
virtual bool continue_solve ()
 
void reset_DeltaMax ()
 sets the history parameter DeltaMax of all particles to zero More...
 
void reset_TangentialSprings ()
 sets the history parameter TangentialSprings of all particles to zero More...
 

Protected Attributes

std::vector< CSpeciesSpecies
 These are the particle parameters like dissipation etc. More...
 
- Protected Attributes inherited from STD_save
std::stringstream problem_name
 Stores the problem_name. More...
 
std::stringstream data_filename
 These store the save file names, by default they are derived from problem_name. More...
 
std::stringstream stat_filename
 
std::stringstream fstat_filename
 
std::stringstream ene_filename
 
std::fstream data_file
 Stream used for data files. More...
 
std::fstream stat_file
 
std::fstream fstat_file
 
std::fstream ene_file
 
unsigned int options_fstat
 Indicators if files are created or not 0: file will not be created 1: file will be written in one file 2: file will be written in multiple files. More...
 
unsigned int options_data
 
unsigned int options_stat
 
unsigned int options_ene
 
unsigned int options_restart
 
unsigned int file_counter
 Counter needed if file will be written in multiple files. More...
 
unsigned int step_size
 

Private Member Functions

void Remove_Duplicate_Periodic_Particles ()
 Remove periodic duplicate Particles (i.e. removes particles created by Check_and_Duplicate_Periodic_Particle(int i, int nWallPeriodic)). Note that between these two functions it is not allowed to create additional functions. More...
 
int Check_and_Duplicate_Periodic_Particles ()
 Calls Check_and_Duplicate_Periodic_Particle for all Particles curently in Particles[] and returns the number of particles created. More...
 

Private Attributes

int dim
 The dimension of the simulation. More...
 
Vec3D gravity
 Gravitational acceleration. More...
 
Mdouble max_radius
 
Mdouble xmin
 These store the size of the domain, assume walls at the ends. More...
 
Mdouble xmax
 
Mdouble ymin
 
Mdouble ymax
 
Mdouble zmin
 
Mdouble zmax
 
Mdouble dt
 These are numerical constants like the time step size. More...
 
Mdouble tmax
 
int save_count_data
 These are informations for saving. More...
 
int save_count_ene
 
int save_count_stat
 
int save_count_fstat
 
bool save_data_data
 
bool save_data_ene
 
bool save_data_fstat
 
bool save_data_stat
 
bool do_stat_always
 
Mdouble t
 This stores the current time. More...
 
Mdouble ene_ela
 used in force calculations More...
 
int xballs_cmode
 
Mdouble xballs_vscale
 
Mdouble xballs_scale
 
std::string xballs_additional_arguments
 
int format
 
int restart_version
 
bool restarted
 
int data_FixedParticles
 
ParticleHandler particleHandler
 
WallHandler wallHandler
 
BoundaryHandler boundaryHandler
 
bool append
 
bool rotation
 
int PeriodicCreated
 
int save_restart_data_counter
 

Friends

std::ostream & operator<< (std::ostream &os, MD &md)
 

Detailed Description

A class that defines and solves a MD problem.

Bug:
When restarting the first time step is not saved, therefore there is a missing time step after a restart

Definition at line 70 of file MD.h.

Constructor & Destructor Documentation

MD::MD ( )
inline

Definition at line 75 of file MD.h.

References constructor().

76  {
77  constructor();
78  #ifdef CONSTUCTOR_OUTPUT
79  std::cerr << "MD() finished"<<std::endl;
80  #endif
81  }
void constructor()
A public constructor, which sets defaults so the problem can be solved off the shelf.
Definition: MD.cc:50
MD::MD ( STD_save other)
inline

Definition at line 83 of file MD.h.

References constructor().

83  : STD_save(other) {
84  constructor();
85  #ifdef CONSTUCTOR_OUTPUT
86  std::cerr << "MD(STD_save& other) finished " << std::endl;
87  #endif
88  }
STD_save()
Default constructor: sets the counter to 0 (i.e. no number will be included).
Definition: STD_save.h:53
void constructor()
A public constructor, which sets defaults so the problem can be solved off the shelf.
Definition: MD.cc:50
virtual MD::~MD ( )
inlinevirtual
Todo:
write a destructor

Definition at line 91 of file MD.h.

91 {};

Member Function Documentation

virtual void MD::actions_after_solve ( )
inlineprotectedvirtual

This is actions at the end of the code, but before the files are closed.

Definition at line 567 of file MD.h.

Referenced by solve().

567 {};
virtual void MD::actions_after_time_step ( )
inlineprotectedvirtual

This is action after the time step is finished.

Definition at line 570 of file MD.h.

Referenced by solve(), and statistics_from_restart_data().

570 {};
virtual void MD::actions_before_time_loop ( )
inlineprotectedvirtual

This is actions before the start of the main time loop.

todo thomas: can this be erased?

Definition at line 545 of file MD.h.

References dt, and set_dt().

Referenced by solve(), and statistics_from_restart_data().

545  {
547  //automatically sets dt if dt is not specified by the user
548  if (!dt) set_dt();
549  };
void set_dt()
Sets dt to 1/50-th of the smallest possible collision time.
Definition: MD.h:447
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
virtual void MD::actions_before_time_step ( )
inlineprotectedvirtual

This is action before the time step is started.

Reimplemented in Chute, and ChuteBottom.

Definition at line 564 of file MD.h.

Referenced by solve(), and statistics_from_restart_data().

564 {};
void MD::add_ene_ela ( Mdouble  new_)
inline

Sets ene_ela.

Definition at line 399 of file MD.h.

References ene_ela.

Referenced by compute_internal_forces(), and compute_walls().

399 {ene_ela+=new_;}
Mdouble ene_ela
used in force calculations
Definition: MD.h:690
void MD::add_Species ( CSpecies S)

Definition at line 1832 of file MD.cc.

References Species.

1832  {
1833  Species.push_back(S);
1834  unsigned int n = Species.size();
1835  Species.back().MixedSpecies.resize(n-1);
1836  for (unsigned int i=0; i<n-1; i++)
1837  Species.back().MixedSpecies[i].mix(Species[i],Species.back());
1838 }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::add_Species ( void  )
inline

Definition at line 505 of file MD.h.

References add_Species(), and Species.

Referenced by add_Species().

505 { add_Species(Species[0]); }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void add_Species(void)
Definition: MD.h:505
virtual void MD::broad_phase ( BaseParticle i)
inlineprotectedvirtual

Broad phase of contact detection goes here. Default check all contacts.

Reimplemented in HGRID_base.

Definition at line 605 of file MD.h.

References BaseHandler< T >::begin(), compute_internal_forces(), and particleHandler.

Referenced by compute_internal_forces().

606  {
607  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); (*it)!=i; ++it)
608  {
610  }
611  }
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:220
ParticleHandler particleHandler
Definition: MD.h:707
virtual void compute_internal_forces(BaseParticle *i)
Computes the forces between particles (internal in the sence that the sum over all these forces is ze...
Definition: MD.cc:1980
int MD::Check_and_Duplicate_Periodic_Particles ( )
private

Calls Check_and_Duplicate_Periodic_Particle for all Particles curently in Particles[] and returns the number of particles created.

Definition at line 2719 of file MD.cc.

References boundaryHandler, BaseBoundary::createPeriodicParticles(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), and particleHandler.

Referenced by solve(), and statistics_from_restart_data().

2720  {
2721 // std::cout<<"Largest R="<<particleHandler.getLargestParticle()->get_Radius()<<std::endl;
2722  int C=0;
2723  for (unsigned int k=0; k<boundaryHandler.getNumberOfObjects(); k++)
2724  {
2725 // std::cout<<"Checking wall number: "<<k<<std::endl;
2726  int N=particleHandler.getNumberOfObjects(); //Required because the number of particles increaeses
2727  for (int i=0; i<N; i++)
2728  {
2729 // std::cout<<"Particle number: "<<i<<std::endl;
2731  }
2732  }
2733  return C;
2734  }
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
virtual int createPeriodicParticles(BaseParticle *P UNUSED, ParticleHandler &pH UNUSED)
Definition: BaseBoundary.h:43
void MD::checkInteractionWithBoundaries ( )
protectedvirtual

Definition at line 1794 of file MD.cc.

References BaseHandler< T >::begin(), boundaryHandler, BaseHandler< T >::end(), and particleHandler.

Referenced by solve().

1795 {
1796  for(std::vector<BaseBoundary*>::iterator B = boundaryHandler.begin(); B!=boundaryHandler.end(); ++B)
1797  {
1798  for (std::vector<BaseParticle*>::iterator P = particleHandler.begin(); P!=particleHandler.end(); ++P)
1799  {
1800  if((*B)->checkBoundaryAfterParticleMoved(*P,particleHandler)) //Returns true if the particle is deleted
1801  --P;
1802  }
1803  }
1804 }
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:220
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:233
void MD::compute_all_forces ( )
protectedvirtual

This does the force computation.

Reset all forces to zero

Now loop over all particles contacts computing force contributions

Now loop over all other particles looking for contacts

Definition at line 1935 of file MD.cc.

References WallHandler::begin(), BaseHandler< T >::begin(), compute_external_forces(), compute_internal_forces(), WallHandler::end(), BaseHandler< T >::end(), PossibleContact::get_Next(), PossibleContact::get_P1(), PossibleContact::get_P2(), particleHandler, and wallHandler.

Referenced by solve(), and statistics_from_restart_data().

1936 {
1938  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it)
1939  {
1940  (*it)->set_Force(Vec3D(0.0,0.0,0.0));
1941  (*it)->set_Torque(Vec3D(0.0,0.0,0.0));
1942  }
1943  for (std::vector<BaseWall*>::iterator it = wallHandler.begin(); it!=wallHandler.end(); ++it)
1944  {
1945  (*it)->set_Force(Vec3D(0.0,0.0,0.0));
1946  (*it)->set_Torque(Vec3D(0.0,0.0,0.0));
1947  } //end reset forces loop
1948 
1949 
1950  #ifdef DEBUG_OUTPUT
1951  std::cerr << "Have all forces set to zero " << std::endl;
1952  #endif
1953 
1955 
1956  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it)
1957  {
1958 
1961  //end inner loop over contacts.
1962 
1964 
1965  }
1966 
1967 #ifdef ContactListHgrid
1968  PossibleContact* Curr=possibleContactList.getFirstPossibleContact();
1969  while(Curr)
1970  {
1971  compute_internal_forces(Curr->get_P1(),Curr->get_P2());
1972  Curr=Curr->get_Next();
1973  }
1974 #endif
1975  //end outer loop over contacts.
1976 
1977 }
Particle * get_P2()
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:220
virtual void compute_external_forces(BaseParticle *PI)
This is were the computation of external forces takes place (e.g. gravity)
Definition: MD.cc:1410
PossibleContact * get_Next()
WallHandler wallHandler
Definition: MD.h:708
ParticleHandler particleHandler
Definition: MD.h:707
const std::vector< BaseWall * >::const_iterator begin() const
Gets the begin of the const_iterator over all BaseWall in this WallHandler.
Definition: WallHandler.cc:242
const std::vector< BaseWall * >::const_iterator end() const
Gets the end of the const_iterator over all BaseWall in this WallHandler.
Definition: WallHandler.cc:254
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:233
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
virtual void compute_internal_forces(BaseParticle *i)
Computes the forces between particles (internal in the sence that the sum over all these forces is ze...
Definition: MD.cc:1980
Particle * get_P1()
void MD::compute_external_forces ( BaseParticle PI)
protectedvirtual

This is were the computation of external forces takes place (e.g. gravity)

This computes the external forces e.g. here it is gravity and walls.

Now add on gravity

Finally walls

Definition at line 1410 of file MD.cc.

References BaseParticle::add_Force(), compute_walls(), get_gravity(), BaseParticle::get_Mass(), and BaseParticle::isFixed().

Referenced by compute_all_forces().

1411 {
1412  if (!CI->isFixed()) {
1414  CI->add_Force(get_gravity() * CI->get_Mass());
1416  compute_walls(CI);
1417  }
1418 }
Vec3D get_gravity()
Allows the gravitational acceleration to be accessed.
Definition: MD.h:364
virtual void compute_walls(BaseParticle *PI)
This is were the walls are.
Definition: MD.cc:1423
void MD::compute_internal_forces ( BaseParticle i)
protectedvirtual

Computes the forces between particles (internal in the sence that the sum over all these forces is zero i.e. fully modelled forces)

Definition at line 1980 of file MD.cc.

References broad_phase().

Referenced by broad_phase(), HGRID_2D::CheckCell(), HGRID_3D::CheckCell(), HGRID_2D::CheckCell_current(), HGRID_3D::CheckCell_current(), and compute_all_forces().

1980  {
1981  broad_phase(i);
1982 }
virtual void broad_phase(BaseParticle *i)
Broad phase of contact detection goes here. Default check all contacts.
Definition: MD.h:605
void MD::compute_internal_forces ( BaseParticle P1,
BaseParticle P2 
)
protectedvirtual

Computes the forces between particles (internal in the sence that the sum over all these forces is zero i.e. fully modelled forces)

This computer the internal forces (internal in the sence that they sum to zero) i.e. the fully modelled forces.

Tangential spring information is always store in the real particle with highest index When a Periodic contact is encountered it is always encoutered twice (for normal periodic walls), but the force is only applied to the real particle The tangential spring information for periodic particles is stored in the normal particle (and thus twice for normal periodic interactions) When a Particle is removed the tangential spring information has to be moved

Both options are up to first order the same (the first one is nicer becaus it always keeps the spring tangential, whereas the second one is in a nicer intergration form)

Todo:
{The spring should be cut back such that fdott=mu*fdotn. This is simple for dispt=0; we have to think about what happens in the sliding case with tang. dissipation; same for walls; Update Dec-2-2011: fixed}
Todo:
TW: the following 13 lines concern only the sliding spring and could be moved into the if statement above
Todo:
Define the center this way or are radii involved? Or maybe just use middle of overlap region? Thomas: Yes, we should correct that for polydispersed problems; however, then we also have to correct it in StatisticsVector::gather_statistics_collision.

The second particle (i.e. the particle the force acts on) is always a flow particle

Todo:
{Is it the first particle the force acts on?}

Definition at line 756 of file MD.cc.

References add_ene_ela(), BaseParticle::add_Force(), BaseParticle::add_Torque(), CSpecies::AdhesionForceType, computeShortRangeForceWithParticle(), Cross(), CTangentialSpring::delta, CSpecies::disp, CSpecies::disprolling, CSpecies::dispt, CSpecies::disptorsion, STD_save::fstat_file, gather_statistics_collision(), BaseParticle::get_AngularVelocity(), get_do_stat_always(), get_dt(), CSpecies::get_ForceType(), BaseParticle::get_Index(), BaseParticle::get_IndSpecies(), BaseParticle::get_InteractionRadius(), BaseParticle::get_Mass(), get_MixedSpecies(), BaseParticle::get_PeriodicFromParticle(), BaseParticle::get_Position(), BaseParticle::get_Radius(), get_save_data_ene(), get_save_data_fstat(), get_save_data_stat(), get_t(), BaseParticle::get_Velocity(), Vec3D::GetLength(), Vec3D::GetLength2, getTangentialSpring(), Hertzian, HM, HMD, BaseParticle::isFixed(), CSpecies::k, CSpecies::krolling, CSpecies::kt, CSpecies::ktorsion, CSpecies::mu, CSpecies::murolling, CSpecies::mus, CSpecies::musrolling, CSpecies::mustorsion, CSpecies::mutorsion, None, R, CTangentialSpring::RollingSpring, Vec3D::set_zero(), CTangentialSpring::sliding, CTangentialSpring::SlidingForce, CTangentialSpring::slidingRolling, CTangentialSpring::slidingTorsion, Species, sqr, CTangentialSpring::TorsionSpring, CSpecies::update_disp(), and CSpecies::useRestitution.

757 {
758  //this is because the rough bottom allows overlapping fixed particles
759  if (P1->isFixed()&&P2->isFixed()) return;
760 
765 
766  //Dificult cases for tangential springs in comination with periodic walls are:
767  //
768  // A new contact over a periodic wall:
769  // Starting situation: There are no tangential springs stored at all
770  // Creating periodic particles: There are no tangential springs so nothing happens
771  // Contact detection: There are two contacts detected, one (CA) for P1 with P2per and one (CB) for P2 with P1per
772  // Switch to the 4 cases:
773  // CA: PI=P1, PJ=P2per PJreal=P2
774  // CB: PI=P2, PJ=P1per PJreal=P1
775  // Reconnecting springs:
776  // CA: PI=P1 and PJ=P2per do not have a spring, so a new spring is created in either PI or PJ (could be in periodic particle)
777  // CB: PI=P2 and PJ=P1Per do not have a spring, so a new spring is created in either PI or PJ (could be in periodic particle)
778  // Removing periodic particles: One of the springs will be stored in a periodic particle and thus removed, the other spring is kept and used (this is the real particle with the kighest index)
779 
780  // Reconnect to a contact over a periodic wall:
781  // Starting situation: There is a tangential spring stored in the particle with the highest index, lets assume this is P1
782  // Creating periodic particles: P1 has a tangential spring, so P1per has a reversed copy of this spring
783  // Contact detection: There are two contacts detected, one (CA) for P1 with P2per and one (CB) for P2 with P1per
784  // Switch to the 4 cases:
785  // CA: PI=P1, PJ=P2per PJreal=P2
786  // CB: PI=P2, PJ=P1per PJreal=P1
787  // Reconnecting springs:
788  // CA: PI=P1 and PJ=P2per have a spring in P1, so we reconnect to this spring in the normal way and integrate it.
789  // CB: PI=P2 and PJ=P1Per have a spring in P1per, however this spring has to be a reversed spring since it is in PJ.
790  // Removing periodic particles: The spring in P1per is removed
791 
792  //Cases (start from P1 and P2 and go to PI and PJ
793  //1 Normal-Normal ->PI=max(P1,P2), PJ=min(P1,P2)
794  //2 Periodic-Normal ->(PI=P2 PJ=real(P1))
795  //3 Normal-Periodic ->(PI=P1 PJ=real(P2))
796  //4 Periodic-Periodic ->do nothing
797 
798  //Just some statements to handle the 4 cases
799  BaseParticle *PI, *PJ, *PJreal;
800  bool isPeriodic;
803  if(P1Per==NULL)
804  {
805  if(P2Per==NULL)//N-N
806  if(P1->get_Index()<P2->get_Index())
807  {PI=P2;PJ=P1;PJreal=P1;isPeriodic=false;}
808  else
809  {PI=P1;PJ=P2;PJreal=P2;isPeriodic=false;}
810  else //N-P
811  {PI=P1;PJ=P2;PJreal=P2Per;isPeriodic=true;}
812  } else {
813  if(P2Per==NULL) //P-N
814  {PI=P2;PJ=P1;PJreal=P1Per;isPeriodic=true;}
815  else return;
816  }
817 
818 #ifdef DEBUG_OUTPUT
819  std::cerr << "In computing internal forces between particle "<<PI->get_Position()<<" and "<<PJ->get_Position()<<std::endl;
820 #endif
821 
822  //Get the square of the distance between particle i and particle j
823  Mdouble dist_squared=GetDistance2(PI->get_Position(), PJ->get_Position());
824  Mdouble interactionRadii_sum=PI->get_InteractionRadius()+PJ->get_InteractionRadius();
825 
826 #ifdef DEBUG_OUTPUT_FULL
827  std::cerr << "Square of distance between " << dist_squared << " square sum of radii " << radii_sum*radii_sum <<std::endl;
828 #endif
829 
830  // True if the particles are in contact
831  if (dist_squared<(interactionRadii_sum*interactionRadii_sum))
832  {
833  // For particles of the same species, set species vector to Species(PI);
834  // for particles of different species, set species vector to MixedSpecies(PI,PJ)
836 
837  // Calculate distance between the particles
838  Mdouble dist=sqrt(dist_squared);
839 
840  // Compute normal vector
841 
842  Vec3D normal=(PI->get_Position()-PJ->get_Position())/dist;
843 
844  // Compute the overlap between the particles
845  Mdouble radii_sum=PI->get_Radius()+PJ->get_Radius();
846  Mdouble deltan = std::max(0.0,radii_sum-dist);
847 
848  Vec3D force= Vec3D(0,0,0);;
849  Vec3D forcet; forcet.set_zero();
850  Vec3D forcerolling; forcerolling.set_zero();
851  Vec3D forcetorsion; forcetorsion.set_zero();
852  Mdouble fdotn = 0;
853  CTangentialSpring* TangentialSpring = NULL;
854 
855  //evaluate shortrange non-contact forces
856  if (pSpecies->AdhesionForceType!=None)
857  fdotn += computeShortRangeForceWithParticle(PI, PJ, PJreal, pSpecies, dist);
858 
859  if (deltan>0) //if contact forces
860  {
861 
862  // Compute the relative velocity vector v_ij
863  Vec3D vrel;
864  if (!pSpecies->mu) {
865  vrel=(PI->get_Velocity()-PJ->get_Velocity());
866  } else {
867  vrel=(PI->get_Velocity()-PJ->get_Velocity()) + Cross(normal, PI->get_AngularVelocity() * (PI->get_Radius() - .5 * deltan) + PJ->get_AngularVelocity() * (PJ->get_Radius() - .5 * deltan) );
868  }
869 
870  // Compute the projection of vrel onto the normal (can be negative)
871  Mdouble vdotn=-Dot(vrel,normal);
872 
873  //update restitution coeff
874  if (pSpecies->useRestitution) pSpecies->update_disp(PI->get_Mass(),PJ->get_Mass());
875  Mdouble a=0, R=0;
876 
877  // Compute normal force on particle i due to contact
878  if (pSpecies->get_ForceType()==HM||pSpecies->get_ForceType()==HMD)
879  {
880  //R is twice the effective radius
881  R = 2.0*PI->get_Radius()*PJ->get_Radius()/(PI->get_Radius()+PJ->get_Radius());
882  a = sqrt(R*deltan);
883  //pSpecies->k stores the elastic modulus
884  Mdouble kn = 4./3. * pSpecies->k * a;
885  fdotn += kn * deltan + pSpecies->disp*vdotn;
886  } else {
887  fdotn += pSpecies->k*deltan+pSpecies->disp*vdotn;
888  }
889  force += normal * fdotn;
890 
891  //If tangential forces are present
892  if (pSpecies->mu || pSpecies->murolling || pSpecies->mutorsion) {
893  //call tangential spring
894  if (pSpecies->kt || pSpecies->krolling || pSpecies->ktorsion)
895  TangentialSpring = getTangentialSpring(PI, PJ, PJreal);
896 
897  //Compute norm of normal force
898  Mdouble norm_fn = fabs(fdotn);
899 
900  //calculate sliding friction
901  if (pSpecies->mu) {
902  //Compute the tangential component of vrel
903  Vec3D vrelt=vrel+normal*vdotn;
904  //Compute norm of vrelt
905  Mdouble vdott=vrelt.GetLength();
906 
907  if (pSpecies->kt) {
908  Vec3D* delta = &(TangentialSpring->delta);
909 
910  //Integrate the spring
912  //(*delta) += vrelt * dt - Dot(*delta,normal)*normal;
913  Vec3D ddelta = (vrelt - Dot(*delta,PI->get_Velocity()-PJ->get_Velocity())*normal/dist) * get_dt();
914  (*delta) += ddelta;
915 
916  //Calculate test force including viscous force
917  if (pSpecies->get_ForceType()==HM) {
918  //pSpecies->kt stores the elastic shear modulus
919  Mdouble kt = 8. * pSpecies->kt * a;
920  TangentialSpring->SlidingForce += - kt * ddelta;
921  forcet = TangentialSpring->SlidingForce - pSpecies->dispt * vrelt;
922  } else if (pSpecies->get_ForceType()==HMD) {
923  //pSpecies->kt stores the elastic shear modulus
924  forcet = TangentialSpring->SlidingForce - pSpecies->dispt * vrelt;
925  Mdouble kt = 8. * pSpecies->kt * a * pow(1- GetLength(forcet)/pSpecies->mu/fdotn,0.33);
926  TangentialSpring->SlidingForce += - kt * ddelta;
927  forcet = TangentialSpring->SlidingForce - pSpecies->dispt * vrelt;
928  } else {
929  forcet = (-pSpecies->dispt) * vrelt - pSpecies->kt * (*delta);
930  }
931 
932  Mdouble forcet2 = forcet.GetLength2();
933 
934  //tangential forces are modelled by a spring-damper of elastisity kt and viscosity dispt (sticking),
935  //but the force is limited by Coulomb friction (sliding):
936  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
937  double muact=(TangentialSpring->sliding)?(pSpecies->mu):(pSpecies->mus); // select mu from previous sliding mode
938  if( forcet2 <= sqr(muact*norm_fn) ) {
939  //sticking++;
940  TangentialSpring->sliding=false;
941  } else {
942  //sliding++;
943  TangentialSpring->sliding=true;
945  Mdouble norm_forcet = sqrt(forcet2);
946  forcet *= pSpecies->mu * norm_fn / norm_forcet;
947  TangentialSpring->SlidingForce = forcet + pSpecies->dispt * vrelt;
948  (*delta) = TangentialSpring->SlidingForce/(-pSpecies->kt);
949  }
950 
951  //Add tangential force to total force
952  force += forcet;
953 
954  } else { //if no tangential spring
955  //tangential forces are modelled by a damper of viscosity dispt (sticking),
956  //but the force is limited by Coulomb friction (sliding):
957  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
958  if (vdott*pSpecies->dispt <= pSpecies->mus*norm_fn) { //sticking++;
959  forcet = -pSpecies->dispt * vrelt;
960  } else { //sliding++;
961  //set force to Coulomb limit
962  forcet = -(pSpecies->mu * norm_fn / vdott) * vrelt;
963  }
964  //Add tangential force to total force
965  force += forcet;
966  }
967  }
968 
969  //calculate rolling friction
970  if (pSpecies->murolling) {
971  //From Luding2008, objective rolling velocity (eq 15) w/o 2.0!
972  Mdouble reducedRadiusI = PI->get_Radius() - .5 * deltan;
973  Mdouble reducedRadiusJ = PJ->get_Radius() - .5 * deltan;
974  Mdouble reducedRadiusIJ = 2.0*reducedRadiusI*reducedRadiusJ/(reducedRadiusI+reducedRadiusJ);
975  Vec3D vrolling=-reducedRadiusIJ * Cross(normal, PI->get_AngularVelocity() - PJ->get_AngularVelocity());
976  if (pSpecies->krolling) {
977  Vec3D* RollingSpring = &(TangentialSpring->RollingSpring);
978 
979  //Integrate the spring
980  (*RollingSpring) += vrolling * get_dt();// - Dot(*RollingSpring,normal)*normal;
981 
982  //Calculate test force including viscous force
983  forcerolling = (-pSpecies->disprolling) * vrolling - pSpecies->krolling * (*RollingSpring);
984  Mdouble forcerolling2 = forcerolling.GetLength2();
985 
986  //tangential forces are modelled by a spring-damper of elastisity kt and viscosity dispt (sticking),
987  //but the force is limited by Coulomb friction (sliding):
988  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
989  double muact=(TangentialSpring->slidingRolling)?(pSpecies->murolling):(pSpecies->musrolling); // select mu from previous sliding mode
990  if( forcerolling2 <= sqr(muact*norm_fn) ) {
991  //sticking++;
992  TangentialSpring->slidingRolling=false;
993  } else {
994  //sliding++;
995  TangentialSpring->slidingRolling=true;
996  forcerolling *= pSpecies->murolling * norm_fn / sqrt(forcerolling2);
997  (*RollingSpring) = (forcerolling + pSpecies->disprolling * vrolling)/(-pSpecies->krolling);
998  }
999 
1000  //Add tangential force to torque
1001  Vec3D Torque = reducedRadiusIJ * Cross(normal, forcerolling);
1002  PI->add_Torque(Torque);
1003  PJreal->add_Torque(-Torque);
1004  }
1005  }
1006 
1007 
1008  //calculate torsive friction
1009  if (pSpecies->mutorsion) {
1010  //From Luding2008, spin velocity (eq 16) w/o 2.0!
1011  Mdouble RadiusIJ = 2.0*PI->get_Radius()*PJ->get_Radius()/(PI->get_Radius()+PJ->get_Radius());
1012  Vec3D vtorsion=RadiusIJ*Dot(normal,PI->get_AngularVelocity() - PJ->get_AngularVelocity())*normal;
1013  if (pSpecies->ktorsion) {
1014  //~ std::cout << "Error; not yet implemented" << std::endl;
1015  //~ exit(-1);
1016  Vec3D* TorsionSpring = &(TangentialSpring->TorsionSpring);
1017 
1018  //Integrate the spring
1019  (*TorsionSpring) = Dot((*TorsionSpring) + vtorsion * get_dt(),normal)*normal;
1020 
1021  //Calculate test force including viscous force
1022  forcetorsion = (-pSpecies->disptorsion) * vtorsion - pSpecies->ktorsion * (*TorsionSpring);
1023  Mdouble forcetorsion2 = forcetorsion.GetLength2();
1024 
1025  //tangential forces are modelled by a spring-damper of elastisity kt and viscosity dispt (sticking),
1026  //but the force is limited by Coulomb friction (sliding):
1027  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
1028  double muact=(TangentialSpring->slidingTorsion)?(pSpecies->mutorsion):(pSpecies->mustorsion); // select mu from previous sliding mode
1029  if( forcetorsion2 <= sqr(muact*norm_fn) ) {
1030  //sticking++;
1031  TangentialSpring->slidingTorsion=false;
1032  } else {
1033  //sliding++;
1034  TangentialSpring->slidingTorsion=true;
1035  //~ std::cout << "sliding " << std::endl;
1036  forcetorsion *= pSpecies->mutorsion * norm_fn / sqrt(forcetorsion2);
1037  (*TorsionSpring) = (forcetorsion + pSpecies->disptorsion * vtorsion)/(-pSpecies->ktorsion);
1038  }
1039 
1040  //Add tangential force to torque
1041  Vec3D torque = RadiusIJ * forcetorsion;
1042  PI->add_Torque(torque);
1043  PJreal->add_Torque(-torque);
1044 
1045  }
1046  }
1047  } //end if tangential forces
1048 
1050  //Make force Hertzian (note: deltan is normalized by the normal distanct of two particles in contact, as in Silbert)
1051  if (pSpecies->get_ForceType()==Hertzian) force *= sqrt(deltan/(PI->get_Radius()+PJ->get_Radius()));
1052 
1053  } else {//end if contact forces
1054  force += fdotn*normal;
1055  }
1056 
1057  //Add forces to total force
1058  PI->add_Force(force);
1059  if(!isPeriodic)
1060  PJreal->add_Force(-force);
1061 
1062  // Add torque due to tangential forces: t = Cross(l,f), l=dist*Wall.normal
1063  if (pSpecies->mu) {
1064  Vec3D cross = Cross(normal, force);
1065  PI ->add_Torque(-cross * (PI->get_Radius() - .5 * deltan));
1066  if(!isPeriodic)
1067  PJreal->add_Torque(-cross * (PJ->get_Radius() - .5 * deltan));
1068  }
1069 
1070  // output for ene and stat files:
1071  if (get_save_data_ene()) {
1072  if(!isPeriodic)
1073  add_ene_ela(0.5 * (pSpecies->k * sqr(deltan) + (TangentialSpring?
1074  (pSpecies->kt * TangentialSpring->delta.GetLength2()
1075  +pSpecies->krolling * TangentialSpring->RollingSpring.GetLength2()
1076  +pSpecies->ktorsion * TangentialSpring->TorsionSpring.GetLength2()):0.0)));
1077  else
1078  add_ene_ela(0.25* (pSpecies->k * sqr(deltan) + (TangentialSpring?
1079  (pSpecies->kt * TangentialSpring->delta.GetLength2()
1080  +pSpecies->krolling * TangentialSpring->RollingSpring.GetLength2()
1081  +pSpecies->ktorsion * TangentialSpring->TorsionSpring.GetLength2()):0.0)));
1082  }
1084 
1085  Mdouble fdott = forcet.GetLength();
1086  Mdouble deltat_norm = TangentialSpring?(-TangentialSpring->delta.GetLength()):0.0;
1087 
1090  Vec3D centre = 0.5 * (PI->get_Position() + PJ->get_Position());
1091 
1095 
1096  if (!PI->isFixed())
1097  {
1098  if(get_save_data_stat()||get_do_stat_always()) gather_statistics_collision(PJreal->get_Index(),PI->get_Index(), centre, deltan, deltat_norm,fdotn,fdott,-normal,-(fdott?forcet/fdott:forcet));
1100  << get_t() << " "
1101  << PJreal->get_Index() << " "
1102  << PI->get_Index() << " "
1103  << centre << " "
1104  << radii_sum-dist << " "
1105  << deltat_norm << " "
1106  << fdotn << " "
1107  << fdott << " "
1108  << -normal << " "
1109  << -(fdott?forcet/fdott:forcet) << std::endl;
1110  }
1111  if (!PJreal->isFixed()&&!isPeriodic)
1112  {
1113  if(get_save_data_stat()||get_do_stat_always()) gather_statistics_collision(PI->get_Index(),PJreal->get_Index(), centre, deltan, deltat_norm,fdotn,fdott,normal,(fdott?forcet/fdott:forcet));
1115  << get_t() << " "
1116  << PI->get_Index() << " "
1117  << PJreal->get_Index() << " "
1118  << centre << " "
1119  << radii_sum-dist << " "
1120  << deltat_norm << " "
1121  << fdotn << " "
1122  << fdott << " "
1123  << normal << " "
1124  << (fdott?forcet/fdott:forcet) << std::endl;
1125  }
1126  }
1127 #ifdef FOLLOWPARTICLE
1128  if(PI->get_Index()==FPID||PJ->get_Index()==FPID)
1129  std::cout<<"Particle collission at time="<<get_t()<<" between "<<PI->get_Index()<<" and "<<PJ->get_Index()<<std::endl;
1130 #endif
1131 
1132  } // end if particle i and j are overlapping
1133 }
std::fstream fstat_file
Definition: STD_save.h:254
Definition: CSpecies.h:29
void add_Torque(const Vec3D &_new)
CTangentialSpring * getTangentialSpring(BaseParticle *PI, BaseParticle *PJ, BaseParticle *PJreal)
Definition: MD.cc:706
CSpecies * get_MixedSpecies(int i, int j)
Allows the mixed species to be accessed.
Definition: MD.h:131
const Vec3D & get_Velocity() const
Mdouble disptorsion
Definition: CSpecies.h:416
Mdouble get_InteractionRadius() const
void add_ene_ela(Mdouble new_)
Sets ene_ela.
Definition: MD.h:399
int get_IndSpecies() const
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
Mdouble mus
Definition: CSpecies.h:418
BaseParticle * get_PeriodicFromParticle() const
Mdouble disp
Definition: CSpecies.h:413
Matrix3D Cross(const Vec3D &A, const Matrix3D &B)
Definition: Matrix.h:198
#define sqr(a)
Definition: ExtendedMath.h:36
bool useRestitution
Definition: CSpecies.h:504
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
bool get_save_data_stat()
Definition: MD.h:268
int get_Index() const
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
bool get_save_data_fstat()
Definition: MD.h:267
Mdouble computeShortRangeForceWithParticle(BaseParticle *PI, BaseParticle *PJ, BaseParticle *PJreal, CSpecies *pSpecies, Mdouble dist)
Definition: MD.cc:1711
friend Mdouble GetLength2(const Vec3D &A)
Definition: Vector.h:183
Vec3D delta
stores the spring
bool isFixed()
Is fixed Particle function. It returns wether a Particle is fixed or not, by cheking its inverse Mass...
Mdouble get_Radius() const
virtual void gather_statistics_collision(int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED)
Definition: MD.h:584
Mdouble get_Mass() const
Mdouble kt
Definition: CSpecies.h:410
Mdouble mu
Definition: CSpecies.h:417
Definition: CSpecies.h:30
bool get_save_data_ene()
Definition: MD.h:266
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
double Mdouble
Definition: ExtendedMath.h:33
Mdouble mustorsion
Definition: CSpecies.h:422
Mdouble k
Definition: CSpecies.h:409
Stores the tangential spring needed to compute a tangential elastic force between particles PI...
void add_Force(const Vec3D &_new)
Definition: CSpecies.h:29
const Vec3D & get_Position() const
Mdouble mutorsion
Definition: CSpecies.h:421
Mdouble murolling
Definition: CSpecies.h:419
void set_zero()
Definition: Vector.h:55
Mdouble krolling
Definition: CSpecies.h:411
Vec3D SlidingForce
Stores the force (for some non-linear, hysteretic spring models)
Mdouble musrolling
Definition: CSpecies.h:420
Mdouble GetLength() const
Definition: Vector.h:248
Mdouble disprolling
Definition: CSpecies.h:415
ForceTypes get_ForceType() const
Definition: CSpecies.h:430
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Stores properties of the particles and the contact models such as the elastic modulus.
Definition: CSpecies.h:56
void update_disp(Mdouble mass1, Mdouble mass2)
Definition: CSpecies.h:165
Mdouble ktorsion
Definition: CSpecies.h:412
Mdouble dispt
Definition: CSpecies.h:414
bool get_do_stat_always()
Definition: MD.h:269
const Vec3D & get_AngularVelocity() const
void MD::compute_particle_masses ( )
inlineprotected

Computes the mass of each particle.

Definition at line 618 of file MD.h.

References BaseParticle::compute_particle_mass(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), particleHandler, and Species.

Referenced by solve(), and statistics_from_restart_data().

void compute_particle_mass(std::vector< CSpecies > &Species)
Compute Particle mass function, which required a reference to the Species vector. It copmuters the Pa...
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
ParticleHandler particleHandler
Definition: MD.h:707
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
void MD::compute_plastic_internal_forces ( BaseParticle P1,
BaseParticle P2 
)
protected

Computes plastic forces between particles.

This computer the internal forces for the plastic model.

Tangential spring information is always store in the real particle with highest index When a Periodic contact is encountered it is always enstd::coutered twice, but only applied when the real particle has the highest index of both real indices When a Particle is removed the tangential spring information has to be moved

newcode begin

Both options are up to first order the same (the first one is nicer becaus it always keeps the spring tangential, whereas the second one is in a nicer intergration form)

Todo:
{The spring should be cut back such that fdott=mu*fdotn. This is simple for dispt=0; we have to think about what happens in the sliding case with tang. dissipation; same for walls}

The second particle (i.e. the particle the force acts on) is always a flow particle

Definition at line 1139 of file MD.cc.

References BaseParticle::add_Force(), BaseParticle::add_Torque(), CSpecies::AdhesionForceType, computeShortRangeForceWithParticle(), Cross(), CTangentialSpring::delta, CSpecies::depth, CSpecies::disp, CSpecies::dispt, do_stat_always, dt, ene_ela, STD_save::fstat_file, gather_statistics_collision(), BaseParticle::get_AngularVelocity(), DeltaMaxsParticle::get_DeltaMaxs(), CSpecies::get_ForceType(), BaseParticle::get_Index(), BaseParticle::get_IndSpecies(), BaseParticle::get_InteractionRadius(), BaseParticle::get_Mass(), get_MixedSpecies(), BaseParticle::get_PeriodicFromParticle(), BaseParticle::get_Position(), BaseParticle::get_Radius(), BaseParticle::get_Velocity(), Vec3D::GetLength(), Vec3D::GetLength2, getTangentialSpring(), Hertzian, BaseParticle::isFixed(), CSpecies::k, CSpecies::k2max, CSpecies::kc, CSpecies::kt, CSpecies::mu, CSpecies::mus, None, save_data_ene, save_data_fstat, save_data_stat, CDeltaMaxs::select_particle(), Vec3D::set_zero(), Species, sqr, t, CSpecies::update_disp(), and CSpecies::useRestitution.

1140 {
1141  //this is because the rough bottom allows overlapping fixed particles
1142  if (P1->isFixed()&&P2->isFixed()) return;
1143 
1147 
1148  //Cases (start from P1 and P2 and go to PI and PJ
1149  //1 Normal-Normal ->PI=max(P1,P2), PJ=min(P1,P2)
1150  //2 Periodic-Normal ->if(P2>Real(P1)) (PI=P2 PJ=real(P1)) otherwise do nothing
1151  //3 Normal-Periodic ->if(P1>Real(P2)) (PI=P1 PJ=real(P2)) otherwise do nothing
1152  //4 Periodic-Periodic ->do nothing
1153 
1154  //Just some statements to handle the 4 cases
1155  BaseParticle *PI, *PJ,*PJreal;
1158  if(P1Per==NULL)
1159  {
1160  if(P2Per==NULL)
1161  //N-N
1162  if(P1->get_Index()<P2->get_Index())
1163  {PI=P2;PJ=P1;PJreal=PJ;}
1164  else
1165  {PI=P1;PJ=P2;PJreal=PJ;}
1166  else
1167  //N-P
1168  if(P1->get_Index()>P2Per->get_Index())
1169  {PI=P1;PJ=P2;PJreal=P2Per;}
1170  else return;
1171  } else {
1172  if(P2Per==NULL)
1173  //P-N
1174  if(P2->get_Index()>P1Per->get_Index())
1175  {PI=P2;PJ=P1;PJreal=P1Per;}
1176  else return;
1177  else return;
1178  }
1179 
1180  #ifdef DEBUG_OUTPUT
1181  std::cerr << "In computing interal forces between particle "<<PI->get_Position()<<" and "<<PJ->get_Position()<<std::endl;
1182  #endif
1183 
1184 
1185  //Get the square of the distance between particle i and particle j
1186  Mdouble dist_squared=GetDistance2(PI->get_Position(), PJ->get_Position());
1187  Mdouble interactionRadii_sum=PI->get_InteractionRadius()+PJ->get_InteractionRadius();
1188 
1189  #ifdef DEBUG_OUTPUT_FULL
1190  std::cerr << "Square of distance between " << dist_squared << " square sum of radii " << radii_sum*radii_sum <<std::endl;
1191  #endif
1192 
1193  // True if the particles are in contact
1194  if (dist_squared<(interactionRadii_sum*interactionRadii_sum))
1195  {
1196  // For particles of the same species, set species vector to Species(PI);
1197  // for particles of different species, set species vector to MixedSpecies(PI,PJ)
1199 
1200  // Calculate distance between the particles
1201  Mdouble dist=sqrt(dist_squared);
1202 
1203  // Compute normal vector
1204  Vec3D normal=(PI->get_Position()-PJ->get_Position())/dist;
1205 
1206  // Compute the overlap between the particles
1207  Mdouble radii_sum=PI->get_Radius()+PJ->get_Radius();
1208  Mdouble deltan = std::max(0.0,radii_sum-dist);
1209 
1210  Vec3D force= Vec3D(0,0,0);;
1211  Vec3D forcet; forcet.set_zero();
1212  Vec3D deltat; deltat.set_zero();
1213  Mdouble fdotn = 0;
1214 
1215  //evaluate shortrange non-contact forces
1216  if (pSpecies->AdhesionForceType!=None)
1217  fdotn += computeShortRangeForceWithParticle(PI, PJ, PJreal, pSpecies, dist);
1218 
1219  if (deltan>0) //if contact forces
1220  {
1221 
1222  // Compute the relative velocity vector v_ij
1223  Vec3D vrel;
1224  if (!pSpecies->mu) {
1225  vrel=(PI->get_Velocity()-PJ->get_Velocity());
1226  } else {
1227  vrel=(PI->get_Velocity()-PJ->get_Velocity()) + Cross(normal, PI->get_AngularVelocity() * (PI->get_Radius() - .5 * deltan) + PJ->get_AngularVelocity() * (PJ->get_Radius() - .5 * deltan) );
1228  }
1229 
1231  // BEGIN add viscous normal force
1232 
1233  // Compute the projection of vrel onto the normal (can be negative)
1234  Mdouble vdotn=-Dot(vrel,normal);
1235 
1236  // Compute normal force on particle i due to contact
1237  if (pSpecies->useRestitution) pSpecies->update_disp(PI->get_Mass(),PJ->get_Mass());
1238  fdotn += pSpecies->disp*vdotn;
1239 
1240  // END add viscous normal force
1241 
1242 
1243  // BEGIN add elastic force
1244 
1245  //calculate deltastar, the overlap above which k2max becomes active (the 'fluid branch')
1246  Mdouble deltastar = (pSpecies->k2max/(pSpecies->k2max-pSpecies->k))*pSpecies->depth*((2*PI->get_Radius()*PJ->get_Radius())/(PI->get_Radius()+PJ->get_Radius()));
1247  //2*depth*r_eff is the overlap at which fn=0 on the k2max branch
1248  //deltastar is the overlap at which the k1 and the k2max branch meet
1249 
1250  //retrieve history parameter deltamax, the max. achieved overlap
1251  DeltaMaxsParticle* DMParticle=dynamic_cast<DeltaMaxsParticle*>(PI);
1252  Mdouble *deltamax = DMParticle->get_DeltaMaxs().select_particle(PJreal->get_Index(), t, dt);
1253  //update deltastar
1254  *deltamax = std::min(deltastar,std::max(*deltamax,deltan));
1255 
1256  //calculate k2(deltamax) (only use first case for Walton-Braun spring)
1257  Mdouble k2;
1258  if (deltan>deltastar) {
1259  k2 = pSpecies->k2max;
1260  } else {
1261  k2 = pSpecies->k+(pSpecies->k2max-pSpecies->k)*((*deltamax)/deltastar);
1262  }
1263 
1264  //calculate delta0(deltamax), the overlap where the force is zero
1265  Mdouble delta0 = (k2-pSpecies->k)/k2*(*deltamax);
1266 
1267  //add elastic force
1268  //std::cout << k2*(deltan-(delta0))-pSpecies->k*deltan << std::endl;
1269  if (deltan>deltastar) {
1270  fdotn += pSpecies->k2max*(deltan-(delta0));
1271  } else if (k2*(deltan-(delta0))>=pSpecies->k*deltan){
1272  fdotn += pSpecies->k*deltan;
1273  } else if (k2*(deltan-delta0)>=-pSpecies->kc*deltan){
1274  fdotn += k2*(deltan-delta0);
1275  } else {
1276  fdotn += -pSpecies->kc*deltan;
1277  *deltamax=(k2+pSpecies->kc)/(k2-pSpecies->k)*deltan;
1278  }
1279 
1280  force = normal * fdotn;
1281  // END add elastic force
1282 
1283 
1284  //If tangential forces are present
1285  if (pSpecies->mu) {
1286 
1287  //Compute the tangential component of vrel
1288  Vec3D vrelt=vrel+normal*vdotn;
1289 
1290  //Compute norm of vrelt
1291  Mdouble vdott=vrelt.GetLength();
1292 
1293  //Compute norm of normal force
1294  Mdouble norm_fn = fabs(fdotn);
1295 
1296  if (!pSpecies->kt) { //if no tangential spring
1297  //tangential forces are modelled by a damper of viscosity dispt (sticking),
1298  //but the force is limited by Coulomb friction (sliding):
1299  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
1300  if (vdott*pSpecies->dispt <= pSpecies->mus*norm_fn) { //sticking++;
1301  forcet = -pSpecies->dispt * vrelt;
1302  } else { //sliding++;
1303  //set force to Coulomb limit
1304  forcet = -(pSpecies->mu * norm_fn / vdott) * vrelt;
1305  }
1306 
1307  } else { //if with tangential spring
1308  //Retrieve the spring
1309  CTangentialSpring* TangentialSpring = getTangentialSpring(PI, PJ, PJreal);
1310  Vec3D* delta = &(TangentialSpring->delta);
1311 
1312  //Integrate the spring
1314  //(*delta) += vrelt * dt - Dot(*delta,normal)*normal;
1315  (*delta) += (vrelt - Dot(*delta,PI->get_Velocity()-PJ->get_Velocity())*normal/dist) * dt;
1316  deltat = (*delta);
1317 
1318  //Calculate test force including viscous force
1319  forcet = (-pSpecies->dispt) * vrelt - pSpecies->kt * deltat;
1320  Mdouble forcet2 = forcet.GetLength2();
1321 
1322  //tangential forces are modelled by a spring-damper of elastisity kt and viscosity dispt (sticking),
1323  //but the force is limited by Coulomb friction (sliding):
1324  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
1325  if( forcet2 <= sqr(pSpecies->mus*norm_fn) ) {
1326  //sticking++;
1327  } else {
1328  //sliding++;
1329  Mdouble norm_forcet = sqrt(forcet2);
1330  forcet *= pSpecies->mu * norm_fn / norm_forcet;
1332  (*delta) = -(forcet + pSpecies->dispt * vrelt)/pSpecies->kt;
1333  //This line should be removed before release it is the old tangential model (the new is shown to be better).
1334  //(*delta) = forcet/(-pSpecies->kt);
1335  }
1336  } //end if tangential spring
1337 
1338  //Add tangential force to total force
1339  force += forcet;
1340 
1341  } //end if tangential forces
1342  } else {//end if contact forces
1343  force = fdotn*normal;
1344  }
1345 
1346  //Make force Hertzian (note: deltan is normalized by the normal distanct of two particles in contact, as in Silbert)
1347  if (pSpecies->get_ForceType()==Hertzian) force *= sqrt(deltan/(PI->get_Radius()+PJ->get_Radius()));
1348 
1349  PI ->add_Force( force);
1350  PJreal->add_Force(-force);
1351 
1352  // Add torque due to tangential forces: t = Cross(l,f), l=dist*Wall.normal
1353  if (pSpecies->mu) {
1354  Vec3D cross = -Cross(normal, force);
1355  PI ->add_Torque(cross * (PI->get_Radius() - .5 * deltan));
1356  PJreal->add_Torque(cross * (PI->get_Radius() - .5 * deltan));
1357  }
1358 
1359  // output for ene and stat files:
1360  if (save_data_ene) {
1361  ene_ela += 0.5 * (pSpecies->k * sqr(deltan) + pSpecies->kt * deltat.GetLength2());
1362  }
1364  Mdouble fdott = forcet.GetLength();
1365  Mdouble deltat_norm = -deltat.GetLength();
1366 
1367  Vec3D centre = 0.5 * (PI->get_Position() + PJ->get_Position());
1370 
1371  if (!PI->isFixed())
1372  {
1373  if(save_data_stat||do_stat_always) gather_statistics_collision(PJreal->get_Index(),PI->get_Index(), centre, deltan, deltat_norm,fdotn,fdott,-normal,-(fdott?forcet/fdott:forcet));
1375  << t << " "
1376  << PJreal->get_Index() << " "
1377  << PI->get_Index() << " "
1378  << centre << " "
1379  << radii_sum-dist << " "
1380  << deltat_norm << " "
1381  << fdotn << " "
1382  << fdott << " "
1383  << -normal << " "
1384  << -(fdott?forcet/fdott:forcet) << std::endl;
1385  }
1386  if (!PJreal->isFixed())
1387  {
1388  if(save_data_stat||do_stat_always) gather_statistics_collision(PI->get_Index(),PJreal->get_Index(), centre, deltan, deltat_norm,fdotn,fdott,normal,(fdott?forcet/fdott:forcet));
1390  << t << " "
1391  << PI->get_Index() << " "
1392  << PJreal->get_Index() << " "
1393  << centre << " "
1394  << radii_sum-dist << " "
1395  << deltat_norm << " "
1396  << fdotn << " "
1397  << fdott << " "
1398  << normal << " "
1399  << (fdott?forcet/fdott:forcet) << std::endl;
1400  }
1401  }
1402  }
1403 
1404  } // end if particle i and j are overlapping
1405 }
std::fstream fstat_file
Definition: STD_save.h:254
bool save_data_fstat
Definition: MD.h:681
Mdouble k2max
Definition: CSpecies.h:500
void add_Torque(const Vec3D &_new)
CTangentialSpring * getTangentialSpring(BaseParticle *PI, BaseParticle *PJ, BaseParticle *PJreal)
Definition: MD.cc:706
Mdouble depth
Definition: CSpecies.h:502
CSpecies * get_MixedSpecies(int i, int j)
Allows the mixed species to be accessed.
Definition: MD.h:131
const Vec3D & get_Velocity() const
Mdouble get_InteractionRadius() const
int get_IndSpecies() const
Mdouble mus
Definition: CSpecies.h:418
BaseParticle * get_PeriodicFromParticle() const
Mdouble disp
Definition: CSpecies.h:413
Matrix3D Cross(const Vec3D &A, const Matrix3D &B)
Definition: Matrix.h:198
#define sqr(a)
Definition: ExtendedMath.h:36
bool do_stat_always
Definition: MD.h:683
bool useRestitution
Definition: CSpecies.h:504
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
int get_Index() const
CDeltaMaxs & get_DeltaMaxs()
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
Mdouble * select_particle(int P, Mdouble time_, Mdouble dt)
Function selects the tangential spring vector for particle-particle interations (also removed not use...
Definition: CDeltaMax.h:111
Mdouble computeShortRangeForceWithParticle(BaseParticle *PI, BaseParticle *PJ, BaseParticle *PJreal, CSpecies *pSpecies, Mdouble dist)
Definition: MD.cc:1711
friend Mdouble GetLength2(const Vec3D &A)
Definition: Vector.h:183
Vec3D delta
stores the spring
bool isFixed()
Is fixed Particle function. It returns wether a Particle is fixed or not, by cheking its inverse Mass...
Mdouble get_Radius() const
virtual void gather_statistics_collision(int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED)
Definition: MD.h:584
Mdouble get_Mass() const
Mdouble kt
Definition: CSpecies.h:410
Mdouble mu
Definition: CSpecies.h:417
Definition: CSpecies.h:30
bool save_data_ene
Definition: MD.h:680
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble t
This stores the current time.
Definition: MD.h:687
double Mdouble
Definition: ExtendedMath.h:33
Mdouble k
Definition: CSpecies.h:409
Stores the tangential spring needed to compute a tangential elastic force between particles PI...
void add_Force(const Vec3D &_new)
bool save_data_stat
Definition: MD.h:682
const Vec3D & get_Position() const
void set_zero()
Definition: Vector.h:55
Mdouble kc
Definition: CSpecies.h:501
Mdouble ene_ela
used in force calculations
Definition: MD.h:690
Mdouble GetLength() const
Definition: Vector.h:248
ForceTypes get_ForceType() const
Definition: CSpecies.h:430
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Stores properties of the particles and the contact models such as the elastic modulus.
Definition: CSpecies.h:56
void update_disp(Mdouble mass1, Mdouble mass2)
Definition: CSpecies.h:165
Mdouble dispt
Definition: CSpecies.h:414
const Vec3D & get_AngularVelocity() const
void MD::compute_walls ( BaseParticle PI)
protectedvirtual

This is were the walls are.

This is were the walls are implemented - normals are outward normals.

Todo:
HMD still has to be fully implemented; HM & HMD requires thinking about how to keep it tangential; you dont need to update delta AND the force
Todo:
: reducedRadiusIJ should have a factor of 2.0, but then the rolling frequency differs from the normal frequency when krolling=2/5*k;
Todo:
: RadiusIJ should have a factor of 2.0, but then the rolling frequency differs from the normal frequency when krolling=2/5*k;

Definition at line 1423 of file MD.cc.

References add_ene_ela(), BaseWall::add_Force(), BaseParticle::add_Force(), BaseWall::add_Torque(), BaseParticle::add_Torque(), CSpecies::AdhesionForceType, computeShortRangeForceWithWall(), Cross(), CTangentialSpring::delta, CSpecies::disp, CSpecies::disprolling, CSpecies::dispt, CSpecies::disptorsion, STD_save::fstat_file, gather_statistics_collision(), BaseParticle::get_AngularVelocity(), BaseWall::get_distance_and_normal(), get_do_stat_always(), get_dt(), CSpecies::get_ForceType(), BaseParticle::get_Index(), BaseParticle::get_IndSpecies(), BaseParticle::get_Mass(), get_MixedSpecies(), BaseParticle::get_PeriodicFromParticle(), BaseParticle::get_Position(), BaseParticle::get_Radius(), get_save_data_ene(), get_save_data_fstat(), get_save_data_stat(), get_t(), BaseParticle::get_Torque(), BaseWall::get_Velocity(), BaseParticle::get_Velocity(), Vec3D::GetLength(), Vec3D::GetLength2, WallHandler::getNumberOfWalls(), getTangentialSpringWall(), WallHandler::getWall(), Hertzian, HM, HMD, BaseWall::indSpecies, BaseParticle::isFixed(), CSpecies::k, CSpecies::krolling, CSpecies::kt, CSpecies::ktorsion, CSpecies::mu, CSpecies::murolling, CSpecies::mus, CSpecies::musrolling, CSpecies::mustorsion, CSpecies::mutorsion, None, R, CTangentialSpring::RollingSpring, BaseParticle::set_Torque(), Vec3D::set_zero(), CTangentialSpring::sliding, CTangentialSpring::SlidingForce, CTangentialSpring::slidingRolling, CTangentialSpring::slidingTorsion, Species, sqr, CTangentialSpring::TorsionSpring, CSpecies::update_disp(), CSpecies::useRestitution, and wallHandler.

Referenced by compute_external_forces().

1424 {
1425  //No need to compute interactions between periodic particle images and walls
1426  if(pI->get_PeriodicFromParticle()!=NULL)
1427  return;
1428 
1429  for (unsigned int i=0; i<wallHandler.getNumberOfWalls(); i++)
1430  {
1431 
1432  // note: normal points away from particle i
1433  Vec3D normal;
1434  Mdouble dist;
1435  bool touch = wallHandler.getWall(i)->get_distance_and_normal(*pI, dist, normal);
1436 
1437  //If the wall is being touched (I think :Ant)
1438  if (touch)
1439  {
1440 
1441  CSpecies* pSpecies = (pI->get_IndSpecies()==wallHandler.getWall(i)->indSpecies)?&Species[pI->get_IndSpecies()]:get_MixedSpecies(pI->get_IndSpecies(),wallHandler.getWall(i)->indSpecies);
1442 
1443  Mdouble deltan = std::max(0.0,pI->get_Radius()-dist);
1444 
1445  Vec3D force= Vec3D(0,0,0);;
1446  Vec3D forcet; forcet.set_zero();
1447  Vec3D forcerolling; forcerolling.set_zero();
1448  Vec3D forcetorsion; forcetorsion.set_zero();
1449  Mdouble fdotn = 0;
1450  CTangentialSpring* TangentialSpring = NULL;
1451 
1452  //evaluate shortrange non-contact forces
1453  if (pSpecies->AdhesionForceType!=None)
1454  fdotn += computeShortRangeForceWithWall(pI, i, pSpecies, dist);
1455 
1456  if (deltan>0) //if contact forces
1457  {
1458 
1459 
1460  // Compute the relative velocity vector v_ij
1461  Vec3D vrel;
1462  if (!pSpecies->mu) {
1463  vrel = pI->get_Velocity() - wallHandler.getWall(i)->get_Velocity();
1464  } else {
1465  vrel = pI->get_Velocity() - wallHandler.getWall(i)->get_Velocity() - Cross(normal, pI->get_AngularVelocity()) * dist;
1466  }
1467 
1468  // Compute the projection of vrel onto the normal (can be negative)
1469  Mdouble vdotn = -Dot(vrel, normal);
1470 
1471  //possibly update restitution coefficient
1472  if (pSpecies->useRestitution) pSpecies->update_disp(pI->get_Mass(),1e20);
1473 
1474  // Compute normal force on particle i due to contact
1475  Mdouble a=0, R=0;
1476  if (pSpecies->get_ForceType()==HM||pSpecies->get_ForceType()==HMD) {
1477  //R is twice the effective radius
1478  R = pI->get_Radius();
1479  a = sqrt(deltan*R);
1480  //pSpecies->k stores the elastic modulus
1481  Mdouble kn = 4./3. * pSpecies->k * a; //it's not really kn
1482  fdotn += kn*deltan - 2*pSpecies->disp*sqrt(pI->get_Mass()*2.*pSpecies->k * a)*vdotn;
1483  } else {
1484  fdotn += pSpecies->k*deltan - pSpecies->disp*vdotn;
1485  }
1486  force = normal * (-fdotn);
1487 
1488  //If tangential forces are present
1489  if (pSpecies->mu || pSpecies->murolling || pSpecies->mutorsion) {
1490  //call tangential spring
1491  if (pSpecies->kt || pSpecies->krolling || pSpecies->ktorsion)
1492  TangentialSpring = getTangentialSpringWall(pI, i);
1493 
1494  //Compute norm of normal force
1495  Mdouble norm_fn = fabs(fdotn);
1496 
1497  //calculate sliding friction
1498  if (pSpecies->mu) {
1499  //Compute the tangential component of vrel
1500  Vec3D vrelt=vrel+normal*vdotn;
1501  //Compute norm of vrelt
1502  Mdouble vdott=vrelt.GetLength();
1503 
1504  if (pSpecies->kt) {
1505  Vec3D* delta = &(TangentialSpring->delta);
1506 
1507  //Integrate the spring
1508  (*delta) += vrelt * get_dt(); //no correction because the normal direction is constant
1509  //std::cout << (vrel) << std::endl;
1510  //Calculate test force including viscous force
1511  if (pSpecies->get_ForceType()==HM) {
1512  //pSpecies->kt stores the elastic shear modulus
1513  Mdouble kt = 8. * pSpecies->kt * a;
1514  //std::cout << "kt" << kt << std::endl;
1515  TangentialSpring->SlidingForce += - kt * (vrelt * get_dt());
1516  a = sqrt(deltan*R);
1517  forcet = TangentialSpring->SlidingForce - 2*pSpecies->dispt * sqrt(pI->get_Mass()*kt) * vrelt;
1518  } else if (pSpecies->get_ForceType()==HMD) {
1519  //pSpecies->kt stores the elastic shear modulus
1520  forcet = TangentialSpring->SlidingForce - pSpecies->dispt * vrelt;
1521  Mdouble kt;
1522  if (get_t()<0.034/10) {
1523  // loading
1524  kt = 8. * pSpecies->kt * a * pow(1.001- GetLength(forcet)/pSpecies->mus/fdotn,1./3.);
1525  } else if (Dot(vrelt,forcet)<=0) {
1526  //unloading in opposite direction
1527  kt = 8. * pSpecies->kt * a * pow(.501 - .5 * GetLength(forcet)/pSpecies->mus/fdotn,1./3.);
1528  } else {
1529  //unloading
1530  kt = 8. * pSpecies->kt * a * pow(.501 + .5* GetLength(forcet)/pSpecies->mus/fdotn,1./3.);
1531  }
1532  TangentialSpring->SlidingForce += - kt * (vrelt * get_dt());
1533  forcet = TangentialSpring->SlidingForce - pSpecies->dispt * vrelt;
1534  } else {
1535  forcet = (-pSpecies->dispt) * vrelt - pSpecies->kt * (*delta);
1536  }
1537 
1538  Mdouble forcet2 = forcet.GetLength2();
1539 
1540  //tangential forces are modelled by a spring-damper of elastisity kt and viscosity dispt (sticking),
1541  //but the force is limited by Coulomb friction (sliding):
1542  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
1543  double muact=(TangentialSpring->sliding)?(pSpecies->mu):(pSpecies->mus); // select mu from previous sliding mode
1544  if( forcet2 <= sqr(muact*norm_fn) ) {
1545  //sticking++;
1546  TangentialSpring->sliding=false;
1547  } else {
1548  //sliding++;
1549  TangentialSpring->sliding=true;
1550  Mdouble norm_forcet = sqrt(forcet2);
1551  forcet *= pSpecies->mu * norm_fn / norm_forcet;
1552  TangentialSpring->SlidingForce = forcet + pSpecies->dispt * vrelt;
1553  (*delta) = TangentialSpring->SlidingForce/(-pSpecies->kt);
1554  }
1555 
1556  //Add tangential force to total force
1557  force += forcet;
1558 
1559  } else { //if no tangential spring
1560  //tangential forces are modelled by a damper of viscosity dispt (sticking),
1561  //but the force is limited by Coulomb friction (sliding):
1562  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
1563  if (vdott*pSpecies->dispt <= pSpecies->mus*norm_fn) { //sticking++;
1564  forcet = -pSpecies->dispt * vrelt;
1565  } else { //sliding++;
1566  //set force to Coulomb limit
1567  forcet = -(pSpecies->mu * norm_fn / vdott) * vrelt;
1568  //std::cout << "sliding " << std::endl;
1569  }
1570  //Add tangential force to total force
1571  force += forcet;
1572  }
1573  }
1574 
1575  //calculate rolling friction
1576  if (pSpecies->murolling) {
1577  //From Luding2008, objective rolling velocity (eq 15) w/o 2.0!
1578  Mdouble reducedRadiusI = pI->get_Radius() - .5 * deltan;
1580  Mdouble reducedRadiusIJ = reducedRadiusI;
1581  Vec3D vrolling=-reducedRadiusIJ * Cross(normal, pI->get_AngularVelocity());
1582  if (pSpecies->krolling) {
1583  Vec3D* RollingSpring = &(TangentialSpring->RollingSpring);
1584 
1585  //Integrate the spring
1586  (*RollingSpring) += vrolling * get_dt();// - Dot(*RollingSpring,normal)*normal;
1587 
1588  //Calculate test force including viscous force
1589  forcerolling = (-pSpecies->disprolling) * vrolling - pSpecies->krolling * (*RollingSpring);
1590  Mdouble forcerolling2 = forcerolling.GetLength2();
1591 
1592  //tangential forces are modelled by a spring-damper of elastisity kt and viscosity dispt (sticking),
1593  //but the force is limited by Coulomb friction (sliding):
1594  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
1595  double muact=(TangentialSpring->slidingRolling)?(pSpecies->murolling):(pSpecies->musrolling); // select mu from previous sliding mode
1596  if( forcerolling2 <= sqr(muact*norm_fn) ) {
1597  TangentialSpring->slidingRolling=false;
1598  } else {
1599  TangentialSpring->slidingRolling=true;
1600  forcerolling *= pSpecies->murolling * norm_fn / sqrt(forcerolling2);
1601  (*RollingSpring) = (forcerolling + pSpecies->disprolling * vrolling)/(-pSpecies->krolling);
1602  }
1603 
1604  //Add tangential force to torque
1605  Vec3D Torque = reducedRadiusIJ * Cross(normal, forcerolling);
1606  pI->add_Torque(Torque);
1607  wallHandler.getWall(i)->add_Torque(Torque);
1608 
1609  }
1610  }
1611 
1612  //calculate torsive friction
1613  if (pSpecies->mutorsion) {
1614  //From Luding2008, spin velocity (eq 16) w/o 2.0!
1616  Mdouble RadiusIJ = pI->get_Radius();
1617  Vec3D vtorsion=RadiusIJ*Dot(normal,pI->get_AngularVelocity())*normal;
1618  if (pSpecies->ktorsion) {
1619  //~ std::cout << "Error; not yet implemented" << std::endl;
1620  //~ exit(-1);
1621  Vec3D* TorsionSpring = &(TangentialSpring->TorsionSpring);
1622 
1623  //Integrate the spring
1624  (*TorsionSpring) = Dot((*TorsionSpring) + vtorsion * get_dt(),normal)*normal;
1625 
1626  //Calculate test force including viscous force
1627  forcetorsion = (-pSpecies->disptorsion) * vtorsion - pSpecies->ktorsion * (*TorsionSpring);
1628  Mdouble forcetorsion2 = forcetorsion.GetLength2();
1629 
1630  //tangential forces are modelled by a spring-damper of elastisity kt and viscosity dispt (sticking),
1631  //but the force is limited by Coulomb friction (sliding):
1632  //f_t = -dispt*vrelt, if dispt*vrelt<=mu_s*fdotn, f_t=mu+s*fdotn*t, else
1633  double muact=(TangentialSpring->slidingTorsion)?(pSpecies->mutorsion):(pSpecies->mustorsion); // select mu from previous
1634  if( forcetorsion2 <= sqr(muact*norm_fn) ) {
1635  //sticking++;
1636  TangentialSpring->slidingTorsion=false;
1637  } else {
1638  //sliding++;
1639  TangentialSpring->slidingTorsion=true;
1640  // std::cout << "torsion sliding " << std::endl;
1641  forcetorsion *= pSpecies->mutorsion * norm_fn / sqrt(forcetorsion2);
1642  (*TorsionSpring) = (forcetorsion + pSpecies->disptorsion * vtorsion)/(-pSpecies->ktorsion);
1643  }
1644 
1645  //Add tangential force to torque
1646  Vec3D Torque = RadiusIJ * forcetorsion;
1647 
1648  if (pSpecies->get_ForceType()==HM||pSpecies->get_ForceType()==HMD) {
1649  //R is twice the effective radius
1650  R = pI->get_Radius();
1651  a = sqrt(deltan*R);
1652  Torque = 20 * a * forcetorsion;
1653  }
1654 
1655  pI->add_Torque(Torque);
1656  wallHandler.getWall(i)->add_Torque(Torque);
1657  //std::cout << " " << Torque.Z << std::endl;
1658  }
1659  }
1660 
1661  } //end if tangential forces
1662  } else {//end if contact forces
1663  force += (-fdotn)*normal;
1664  }
1665 
1666  //Make force Hertzian (note: deltan is normalized by the normal distanct of two particles in contact, as in Silbert)
1667  if (pSpecies->get_ForceType()==Hertzian) force *= sqrt(deltan/(2.0*pI->get_Radius()));
1668 
1669  //Add forces to total force
1670  pI->add_Force(force);
1671  wallHandler.getWall(i)->add_Force(-force);
1672 
1673  if (pSpecies->mu) pI->set_Torque(pI->get_Torque()+Cross(normal, force) * dist);
1674  // Add torque due to tangential forces: t = Cross(l,f), l=dist*Wall.normal
1675 
1676  if (get_save_data_ene()) {
1677  add_ene_ela(0.5 * (pSpecies->k * sqr(deltan) + (TangentialSpring?
1678  (pSpecies->kt * TangentialSpring->delta.GetLength2()
1679  +pSpecies->krolling * TangentialSpring->RollingSpring.GetLength2()
1680  +pSpecies->ktorsion * TangentialSpring->TorsionSpring.GetLength2()):0.0)));
1681  }
1683  {
1684 
1685  deltan = pI->get_Radius()-dist;
1686  Mdouble fdott = forcet.GetLength();
1687  Mdouble deltat_norm = TangentialSpring?(-TangentialSpring->delta.GetLength()):0.0;
1688 
1689  if (!pI->isFixed())
1690  {
1691  if(get_save_data_stat()||get_do_stat_always()) gather_statistics_collision(pI->get_Index(),-(i+1), pI->get_Position() + normal*(pI->get_Radius()-deltan), deltan, deltat_norm,fdotn,fdott,normal,-(fdott?forcet/fdott:forcet));
1693  << get_t() << " "
1694  << pI->get_Index() << " "
1695  << -(static_cast<int>(i)+1) << " "
1696  << pI->get_Position() + normal*(pI->get_Radius()-deltan) << " "
1697  << deltan << " "
1698  << deltat_norm << " "
1699  << fdotn << " "
1700  << fdott << " "
1701  << normal << " "
1702  << -(fdott?forcet/fdott:forcet) << std::endl;
1703  }
1704  }
1705 
1706  } // end if particle i touches the wall
1707 
1708  }//end if for wall i
1709 }
std::fstream fstat_file
Definition: STD_save.h:254
Definition: CSpecies.h:29
CSpecies * get_MixedSpecies(int i, int j)
Allows the mixed species to be accessed.
Definition: MD.h:131
Mdouble disptorsion
Definition: CSpecies.h:416
void add_ene_ela(Mdouble new_)
Sets ene_ela.
Definition: MD.h:399
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
Mdouble mus
Definition: CSpecies.h:418
Mdouble disp
Definition: CSpecies.h:413
Matrix3D Cross(const Vec3D &A, const Matrix3D &B)
Definition: Matrix.h:198
#define sqr(a)
Definition: ExtendedMath.h:36
bool useRestitution
Definition: CSpecies.h:504
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
bool get_save_data_stat()
Definition: MD.h:268
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
bool get_save_data_fstat()
Definition: MD.h:267
WallHandler wallHandler
Definition: MD.h:708
friend Mdouble GetLength2(const Vec3D &A)
Definition: Vector.h:183
Vec3D delta
stores the spring
virtual void gather_statistics_collision(int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED)
Definition: MD.h:584
Mdouble kt
Definition: CSpecies.h:410
Mdouble mu
Definition: CSpecies.h:417
Definition: CSpecies.h:30
bool get_save_data_ene()
Definition: MD.h:266
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
double Mdouble
Definition: ExtendedMath.h:33
Mdouble computeShortRangeForceWithWall(BaseParticle *pI, int wall, CSpecies *pSpecies, Mdouble dist)
Definition: MD.cc:1744
Mdouble mustorsion
Definition: CSpecies.h:422
unsigned int getNumberOfWalls() const
Gets the number of BaseWalls in this WallHandler.
Definition: WallHandler.cc:224
CTangentialSpring * getTangentialSpringWall(BaseParticle *pI, int w)
Definition: MD.cc:741
Mdouble k
Definition: CSpecies.h:409
Stores the tangential spring needed to compute a tangential elastic force between particles PI...
Definition: CSpecies.h:29
virtual bool get_distance_and_normal(BaseParticle &P UNUSED, Mdouble &distance UNUSED, Vec3D &normal_return UNUSED)=0
Mdouble mutorsion
Definition: CSpecies.h:421
Mdouble murolling
Definition: CSpecies.h:419
void set_zero()
Definition: Vector.h:55
Mdouble krolling
Definition: CSpecies.h:411
void add_Force(Vec3D _new)
Definition: BaseWall.h:110
virtual Vec3D get_Velocity() const =0
Vec3D SlidingForce
Stores the force (for some non-linear, hysteretic spring models)
int indSpecies
Definition: BaseWall.h:36
Mdouble musrolling
Definition: CSpecies.h:420
Mdouble GetLength() const
Definition: Vector.h:248
Mdouble disprolling
Definition: CSpecies.h:415
ForceTypes get_ForceType() const
Definition: CSpecies.h:430
BaseWall * getWall(const unsigned int id) const
Gets a pointer to the BaseWall at the specified index in the WallHandler.
Definition: WallHandler.cc:203
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Stores properties of the particles and the contact models such as the elastic modulus.
Definition: CSpecies.h:56
void update_disp(Mdouble mass1, Mdouble mass2)
Definition: CSpecies.h:165
Mdouble ktorsion
Definition: CSpecies.h:412
void add_Torque(Vec3D _new)
Definition: BaseWall.h:111
Mdouble dispt
Definition: CSpecies.h:414
bool get_do_stat_always()
Definition: MD.h:269
Mdouble MD::computeShortRangeForceWithParticle ( BaseParticle PI,
BaseParticle PJ,
BaseParticle PJreal,
CSpecies pSpecies,
Mdouble  dist 
)
protected

Definition at line 1711 of file MD.cc.

References CSpecies::AdhesionForceType, CSpecies::f0, get_dt(), BaseParticle::get_Index(), BaseParticle::get_Radius(), get_t(), TangentialSpringParticle::get_TangentialSprings(), CSpecies::k0, LinearIrreversible, LinearReversible, and CTangentialSprings::select_particle_spring().

Referenced by compute_internal_forces(), and compute_plastic_internal_forces().

1711  {
1712  Mdouble fdotn;
1713  if (pSpecies->AdhesionForceType==LinearReversible)
1714  {
1715  fdotn = std::min(0.0,pSpecies->k0*std::max(dist-PI->get_Radius()-PJ->get_Radius(),0.0)-pSpecies->f0);
1716  }
1717  else if (pSpecies->AdhesionForceType==LinearIrreversible)
1718  {
1719  TangentialSpringParticle* TSParticleI=dynamic_cast<TangentialSpringParticle*>(PI);
1720  TangentialSpringParticle* TSParticleJ=dynamic_cast<TangentialSpringParticle*>(PJ);
1721  //First check if particle I has a spring stores that is connected to particle J
1722  CTangentialSpring* TangentialSpring = TSParticleI->get_TangentialSprings().select_particle_spring(PJreal->get_Index(), get_t(), get_dt());
1723  if(TangentialSpring==NULL)
1724  {
1725  //Then check if particle J has a spring stored that is connected to particle I
1726  TangentialSpring = TSParticleJ->get_TangentialSprings().select_particle_spring(PI->get_Index(), get_t(), get_dt());
1727  }
1728  if(TangentialSpring==NULL)
1729  {
1730  fdotn = (PI->get_Radius()+PJ->get_Radius()>dist)?-pSpecies->f0:0.0;
1731  }
1732  else
1733  {
1734  fdotn = std::min(0.0,pSpecies->k0*std::max(dist-PI->get_Radius()-PJ->get_Radius(),0.0)-pSpecies->f0);
1735  }
1736  }
1737  else
1738  {
1739  fdotn=0;
1740  }
1741  return fdotn;
1742 }
Mdouble k0
Definition: CSpecies.h:508
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
int get_Index() const
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
CTangentialSprings & get_TangentialSprings()
Mdouble get_Radius() const
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
double Mdouble
Definition: ExtendedMath.h:33
Stores the tangential spring needed to compute a tangential elastic force between particles PI...
Mdouble f0
Definition: CSpecies.h:509
CTangentialSpring * select_particle_spring(int P, Mdouble time_, Mdouble dt)
Function selects the tangential spring vector for particle-particle interations (also removed not use...
Mdouble MD::computeShortRangeForceWithWall ( BaseParticle pI,
int  wall,
CSpecies pSpecies,
Mdouble  dist 
)
protected

Definition at line 1744 of file MD.cc.

References CSpecies::AdhesionForceType, CSpecies::f0, get_dt(), BaseParticle::get_Radius(), get_t(), TangentialSpringParticle::get_TangentialSprings(), CSpecies::k0, LinearIrreversible, LinearReversible, and CTangentialSprings::select_wall_spring().

Referenced by compute_walls().

1744  {
1745  Mdouble fdotn;
1746  if (pSpecies->AdhesionForceType==LinearReversible)
1747  {
1748  fdotn = std::min(0.0,pSpecies->k0*std::max(dist-pI->get_Radius(),0.0)-pSpecies->f0);
1749  }
1750  else if (pSpecies->AdhesionForceType==LinearIrreversible)
1751  {
1752  TangentialSpringParticle* TSParticle=dynamic_cast<TangentialSpringParticle*>(pI);
1753  CTangentialSpring* TangentialSpring = TSParticle->get_TangentialSprings().select_wall_spring(wall, get_t(), get_dt());
1754  if(TangentialSpring==NULL)
1755  {
1756  fdotn = (pI->get_Radius()>dist)?-pSpecies->f0:0.0;
1757  }
1758  else
1759  {
1760  fdotn = std::min(0.0,pSpecies->k0*std::max(dist-pI->get_Radius(),0.0)-pSpecies->f0);
1761  }
1762  }
1763  else
1764  {
1765  fdotn=0;
1766  }
1767  return fdotn;
1768 }
Mdouble k0
Definition: CSpecies.h:508
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
AdhesionForceTypes AdhesionForceType
Definition: CSpecies.h:507
CTangentialSprings & get_TangentialSprings()
Mdouble get_Radius() const
CTangentialSpring * select_wall_spring(int W, Mdouble time_, Mdouble dt)
Function selects the tangential spring vector for particle-particle interations (also removed not use...
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
double Mdouble
Definition: ExtendedMath.h:33
Stores the tangential spring needed to compute a tangential elastic force between particles PI...
Mdouble f0
Definition: CSpecies.h:509
void MD::constructor ( )

A public constructor, which sets defaults so the problem can be solved off the shelf.

todo{to incorporate changes in icc a make clean is required. Why?}

This is where the constructor is defines setup a basic two dimensional problem which can be solved off the shelf///

Definition at line 50 of file MD.cc.

References data_FixedParticles, dim, dt, format, gravity, particleHandler, PeriodicCreated, STD_save::problem_name, random, save_restart_data_counter, set_append(), set_dim_particle(), set_do_stat_always(), set_k(), RNG::set_RandomSeed(), set_restarted(), set_rho(), set_save_count_all(), ParticleHandler::setSpecies(), BaseHandler< T >::setStorageCapacity(), Species, tmax, xballs_additional_arguments, xballs_cmode, xballs_scale, xballs_vscale, xmax, xmin, ymax, ymin, zmax, and zmin.

Referenced by MD().

51 {
52  Species.resize(1);
53  set_restarted(false);
54 
55  //This sets the maximum number of particles
58  dim = 2;
59  format = 0;
60 
61  //These are the particle parameters like dissipation etc..
62  set_k(1e4);
63  set_rho(2000);
64  //\todo{Why shouldn't we set dim_particle (which defines the mass calculations) ALWAYS to three, even for 2D problems?}
65  set_dim_particle(2);
66 
67  // Set gravitational acceleration
68  gravity = Vec3D(0.0, -9.8, 0.0);
69 
70  //This is the parameter of the numerical part
71  dt=0e-5; // if dt is not user-specified, this is set in actions_before_time_loop()
73  set_do_stat_always(false);
74  tmax=1.0;
75 
76  //This sets the default xballs domain
77  xmin=0.0;
78  xmax=0.01;
79  ymin=0.0;
80  ymax=0.01;
81  zmin=0.0;
82  zmax=0.0;
83 
84  //This set the default position of walls
85  /*Wall w0;
86  w0.set(Vec3D(-1,0,0), -xmin);
87  wallHandler.copyAndAddWall(w0);
88  w0.set(Vec3D( 1,0,0), xmax);
89  wallHandler.copyAndAddWall(w0);
90  w0.set(Vec3D(0,-1,0), -ymin);
91  wallHandler.copyAndAddWall(w0);
92  w0.set(Vec3D(0, 1,0), ymax);
93  wallHandler.copyAndAddWall(w0);*/
94 
95  problem_name << "Problem_1";
97 
98  //Default mode is energy with no scale of the vectors
99  xballs_cmode=0;
100  xballs_vscale=-1;
101  xballs_scale=-1;
103  set_append(false);
104 
106 
107  PeriodicCreated=0;
108 
109  //The default random seed is 0
111  #ifdef DEBUG_OUTPUT
112  std::cerr << "MD problem constructor finished " << std::endl;
113  #endif
114 }
std::string xballs_additional_arguments
Definition: MD.h:698
int format
Definition: MD.h:699
void set_restarted(bool new_)
Definition: MD.h:383
void set_append(bool new_)
Sets restarted.
Definition: MD.h:391
void setStorageCapacity(const unsigned int N)
Sets the storage capacity of this BaseHandler.
Definition: BaseHandler.h:213
int save_restart_data_counter
Definition: MD.h:723
Mdouble xballs_scale
Definition: MD.h:697
int dim
The dimension of the simulation.
Definition: MD.h:660
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
RNG random
Definition: MD.h:515
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
int xballs_cmode
Definition: MD.h:695
ParticleHandler particleHandler
Definition: MD.h:707
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble xmax
Definition: MD.h:668
Mdouble zmax
Definition: MD.h:668
void setSpecies(std::vector< CSpecies > *)
void set_do_stat_always(bool new_)
Sets how often the data is saved using the number of saves wanted, tmax, and dt. See also set_savecou...
Definition: MD.h:170
void set_dim_particle(int new_, unsigned int indSpecies=0)
Allows the dimension of the particle (f.e. for mass) to be changed.
Definition: MD.h:261
void set_save_count_all(int new_)
Definition: MD.h:156
int PeriodicCreated
Definition: MD.h:722
void set_rho(Mdouble new_, unsigned int indSpecies=0)
Allows the density to be changed.
Definition: MD.h:220
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
Mdouble xballs_vscale
Definition: MD.h:696
Mdouble tmax
Definition: MD.h:672
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble ymin
Definition: MD.h:668
void set_k(Mdouble new_, unsigned int indSpecies=0)
Allows the spring constant to be changed.
Definition: MD.h:204
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
void set_RandomSeed(Mdouble new_seed)
This is the seed for the random number generator.
Definition: RNG.h:46
int data_FixedParticles
Definition: MD.h:702
virtual bool MD::continue_solve ( )
inlineprotectedvirtual

Definition at line 630 of file MD.h.

Referenced by solve().

630 {return true;}
virtual void MD::cout_time ( )
inlineprotectedvirtual

std::couts time

Reimplemented in Chute.

Definition at line 621 of file MD.h.

References t, and tmax.

Referenced by solve().

621  {
622  std::cout << "\rt=" << std::setprecision(3) << std::left << std::setw(6) << t
623  << ", tmax=" << std::setprecision(3) << std::left << std::setw(6) << tmax << " \r";
624  std::cout.flush();
625  #ifdef FOLLOWPARTICLE
626  std::cout<<std::endl;
627  #endif
628  }
Mdouble t
This stores the current time.
Definition: MD.h:687
Mdouble tmax
Definition: MD.h:672
void MD::create_xballs_script ( )
virtual

This creates a scipt which can be used to load the xballs problem to display the data just generated.

This automatically creates an xballs script to plot the data you have just generated///.

First put in all the script lines. All these lines do is move you to the correct directory from any location

Todo:
{thomas:why does vscale have to be integer?}

Definition at line 84 of file MD_xballs.icc.

References STD_save::data_filename, dim, format, STD_save::get_options_data(), STD_save::problem_name, xballs_additional_arguments, xballs_cmode, xballs_scale, xballs_vscale, xmax, xmin, ymax, ymin, zmax, and zmin.

Referenced by solve(), and StatisticsVector< T >::statistics_from_p3().

85 {
86 
87  std::stringstream file_name;
88  std::ofstream script_file;
89  file_name << problem_name.str() <<".xballs";
90  script_file.open((file_name.str()).c_str());
91 
93  script_file << "#!/bin/bash" << std::endl;
94  script_file << "x=$(echo $0 | cut -c2-)" << std::endl;
95  script_file << "file=$PWD$x" << std::endl;
96  script_file << "dirname=`dirname \"$file\"`" << std::endl;
97  script_file << "cd $dirname" << std::endl;
98 
99  Mdouble scale;
100  int format;
101 
102  if (dim<3)
103  { // dim = 1 or 2
104  format = 8;
105  if (xballs_scale<0)
106  {
107  scale = 1.0 / std::max( ymax-ymin, xmax-xmin );
108  }
109  else
110  {
111  scale=xballs_scale;
112  }
113  }
114  else
115  { //dim==3
116  format = 14;
117  if (xballs_scale<0)
118  {
119  scale = 1.2 / std::max( zmax-zmin, xmax-xmin );
120  }
121  else
122  {
123  scale=xballs_scale;
124  }
125 
126  }
127 
128  script_file << "../../xballs/xballs -format " << format
129  << " -f " << data_filename.str() << ((get_options_data()==2)?".0000":"")
130  << " -s " << scale
131  << " -cmode " << xballs_cmode
132  << " -cmax -sort "
134  << " $*";
136  if (xballs_vscale>-1)
137  {
138  script_file << " -vscale " << xballs_vscale;
139  }
140  script_file.close();
141 
142  //This line changes teh file permision and give the owener (i.e. you) read, write and excute permission to the file.
143  #ifdef UNIX
144  chmod((file_name.str().c_str()),S_IRWXU);
145  #endif
146 
147 }
std::string xballs_additional_arguments
Definition: MD.h:698
int format
Definition: MD.h:699
std::stringstream data_filename
These store the save file names, by default they are derived from problem_name.
Definition: STD_save.h:246
Mdouble xballs_scale
Definition: MD.h:697
int dim
The dimension of the simulation.
Definition: MD.h:660
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
int xballs_cmode
Definition: MD.h:695
Mdouble xmax
Definition: MD.h:668
unsigned int get_options_data(void)
Definition: STD_save.h:162
Mdouble zmax
Definition: MD.h:668
double Mdouble
Definition: ExtendedMath.h:33
Mdouble xballs_vscale
Definition: MD.h:696
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
void MD::do_integration_after_force_computation ( BaseParticle pI)
protectedvirtual

This is were the integration is done.

This is were the integration is done, at the moment it is Velocity Verlet integration.

Definition at line 1843 of file MD.cc.

References BaseParticle::accelerate(), BaseParticle::angularAccelerate(), boundaryHandler, PeriodicBoundary::distance(), dt, BaseParticle::get_AngularVelocity(), BaseParticle::get_Force(), get_HGRID_UpdateEachTimeStep(), BaseParticle::get_Index(), BaseParticle::get_InvInertia(), BaseParticle::get_InvMass(), BaseParticle::get_Position(), get_t(), BaseParticle::get_Torque(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), HGRID_RemoveParticleFromHgrid(), HGRID_UpdateParticleInHgrid(), BaseParticle::rotate(), rotation, BaseParticle::set_Position(), BaseParticle::set_Velocity(), and PeriodicBoundary::shift_position().

Referenced by solve().

1844 {
1845 #ifdef USE_SIMPLE_VERLET_INTEGRATION
1846 
1847  static Vec3D xtemp, atemp;
1849  xtemp=pI->get_Position();
1850  atemp=pI->get_Force()*pI->get_InvMass();
1851  pI->set_Position(xtemp*2.0-pI->PrevPosition+atemp*dt*dt);
1852  pI->set_Velocity((pI->get_Position()-pI->PrevPosition)/(2*dt)+atemp*dt);
1853  pI->PrevPosition=xtemp;
1854  if (rotation) {
1855  pI->angularAccelerate(pI->get_Torque()*pI->get_InvInertia()*dt);
1856  pI->rotate(pI->get_AngularVelocity()*dt);
1857  }
1858 
1859  // This shifts particles that moved through periodic walls
1861  for (unsigned int j=0; j<boundaryHandler.getNumberOfObjects(); j++)
1862  {
1864  //Note, checking the dynamic cast allows you to detect if the wall is of a certain type (or inherited from this type).
1865  if(b0) //If the dyamic_cast succeeds
1866  if (b0->distance(*iP)<0)
1867  {
1868  b0->shift_position(iP->get_Position());
1870  {
1873  }
1874  }
1875  }
1876 
1877 #else //use velocity verlet
1878  pI->accelerate(pI->get_Force()*pI->get_InvMass()*0.5*dt);
1879  if (rotation) pI->angularAccelerate(pI->get_Torque()*pI->get_InvInertia()*0.5*dt);;
1880 #endif
1881 #ifdef FOLLOWPARTICLE
1882  if(pI->get_Index()==FPID)
1883  std::cout<<"In integration after time="<<get_t()<<", particle "<<FPID<<": "<<*pI<<std::endl;
1884 #endif
1885 }
void rotate(const Vec3D &_new)
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
void angularAccelerate(const Vec3D &_new)
bool rotation
Definition: MD.h:721
int get_Index() const
Mdouble get_InvInertia() const
virtual void HGRID_RemoveParticleFromHgrid(BaseParticle *obj UNUSED)
Definition: MD.h:560
const Vec3D & get_Force() const
Defines a pair of periodic walls. The particles are in {x: position_left<=normal*x
Mdouble get_InvMass() const
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
Mdouble distance(BaseParticle &P)
Returns the distance of the wall to the particle, and sets left_wall = true, if the left wall is the ...
virtual bool get_HGRID_UpdateEachTimeStep()
Definition: MD.h:561
virtual void HGRID_UpdateParticleInHgrid(BaseParticle *obj UNUSED)
Definition: MD.h:559
void shift_position(BaseParticle *F0)
shifts the particle (after distance set the left_wall value)
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
const Vec3D & get_Position() const
void set_Velocity(const Vec3D &_new)
const Vec3D & get_Torque() const
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
void set_Position(const Vec3D &_new)
void accelerate(const Vec3D &_new)
const Vec3D & get_AngularVelocity() const
void MD::do_integration_before_force_computation ( BaseParticle pI)
protectedvirtual

This is were the integration is done.

This is were the integration is done, at the moment it is Velocity Verlet integration.

Definition at line 1773 of file MD.cc.

References BaseParticle::accelerate(), BaseParticle::angularAccelerate(), dt, BaseParticle::get_AngularVelocity(), BaseParticle::get_Displacement(), BaseParticle::get_Force(), BaseParticle::get_Index(), BaseParticle::get_InvInertia(), BaseParticle::get_InvMass(), get_t(), BaseParticle::get_Torque(), BaseParticle::get_Velocity(), Vec3D::GetLength(), HGRID_update_move(), BaseParticle::move(), BaseParticle::rotate(), rotation, and BaseParticle::set_Displacement().

Referenced by solve().

1774 {
1775 #ifdef USE_SIMPLE_VERLET_INTEGRATION
1776 
1777 #else //use velocity verlet
1778  iP->accelerate(iP->get_Force()*iP->get_InvMass()*0.5*dt);
1779  iP->set_Displacement(iP->get_Velocity()*dt);
1780  iP->move(iP->get_Displacement());
1781  HGRID_update_move(iP,iP->get_Displacement().GetLength());
1782  if (rotation)
1783  {
1784  iP->angularAccelerate(iP->get_Torque()*iP->get_InvInertia()*0.5*dt);
1785  iP->rotate(iP->get_AngularVelocity()*dt);
1786  }
1787 #endif
1788 #ifdef FOLLOWPARTICLE
1789  if(iP->get_Index()==FPID)
1790  std::cout<<"In integration before time="<<get_t()<<", particle "<<FPID<<": "<<*iP<<std::endl;
1791 #endif
1792 }
virtual void HGRID_update_move(BaseParticle *, Mdouble)
Definition: MD.h:594
bool rotation
Definition: MD.h:721
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
bool MD::find_next_data_file ( Mdouble  tmin,
bool  verbose = true 
)

Definition at line 426 of file MD.cc.

References STD_save::data_file, STD_save::get_data_filename(), STD_save::get_file_counter(), STD_save::get_options_data(), STD_save::increase_counter_data(), STD_save::set_file_counter(), and t.

427 {
428  if (get_options_data()==2) {
429  while(true) {
430  increase_counter_data(std::fstream::in);
431  //check if file exists and contains data
432  int N;
433  data_file >> N;
434  if (data_file.eof()||data_file.peek()==-1) {
435  std::cout << "file " << get_data_filename() << " not found" << std::endl;
436  return false;
437  }
438  //check if tmin condition is satisfied
439  Mdouble t;
440  data_file >> t;
441  if (t>tmin) {
443  return true;
444  }
445  if (verbose) std::cout <<"Jumping file counter: "<<get_file_counter() << std::endl;
446  }
447  } else return true;
448  //length = is.tellg();
449  //is.seekg (0, ios::end);
450 }
int get_file_counter()
Definition: STD_save.h:234
std::fstream data_file
Stream used for data files.
Definition: STD_save.h:252
unsigned int get_options_data(void)
Definition: STD_save.h:162
Mdouble t
This stores the current time.
Definition: MD.h:687
double Mdouble
Definition: ExtendedMath.h:33
void set_file_counter(int new_)
Definition: STD_save.h:233
std::string get_data_filename()
Definition: STD_save.h:149
bool increase_counter_data(std::fstream::openmode mode)
Definition: STD_save.h:221
virtual void MD::finish_statistics ( )
inlineprotectedvirtual

Reimplemented in StatisticsVector< T >.

Definition at line 586 of file MD.h.

Referenced by solve().

586 {};
void MD::fstat_header ( )
protectedvirtual

Definition at line 145 of file MD.cc.

References STD_save::fstat_file, BaseParticle::get_Radius(), get_t(), get_xmax(), get_xmin(), get_ymax(), get_ymin(), get_zmax(), get_zmin(), getLargestParticle(), and getSmallestParticle().

Referenced by solve().

146 {
147  // line #1: time, volume fraction
148  // line #2: wall box: wx0, wy0, wz0, wx1, wy1, wz1
149  // line #3: radii-min-max & moments: rad_min, rad_max, r1, r2, r3, r4
150  fstat_file << "#"
151  << " " << get_t()
152  << " " << 0
153  << std::endl;
154  fstat_file << "#"
155  << " " << get_xmin()
156  << " " << get_ymin()
157  << " " << get_zmin()
158  << " " << get_xmax()
159  << " " << get_ymax()
160  << " " << get_zmax()
161  << std::endl;
162  fstat_file << "#"
163  << " " << getSmallestParticle()->get_Radius()
164  << " " << getLargestParticle()->get_Radius()
165  << " " << 0
166  << " " << 0
167  << " " << 0
168  << " " << 0
169  << std::endl;
170 }
std::fstream fstat_file
Definition: STD_save.h:254
Mdouble get_zmin()
Gets zmin.
Definition: MD.h:313
virtual BaseParticle * getLargestParticle()
Definition: MD.h:419
Mdouble get_ymax()
Gets ymax.
Definition: MD.h:311
Mdouble get_Radius() const
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
Mdouble get_ymin()
Gets ymin.
Definition: MD.h:309
Mdouble get_xmin()
Get xmin.
Definition: MD.h:305
Mdouble get_xmax()
Get xmax.
Definition: MD.h:307
virtual BaseParticle * getSmallestParticle()
Definition: MD.h:418
Mdouble get_zmax()
Gets zmax.
Definition: MD.h:315
virtual void MD::gather_statistics_collision ( int index1  UNUSED,
int index2  UNUSED,
Vec3D Contact  UNUSED,
Mdouble delta  UNUSED,
Mdouble ctheta  UNUSED,
Mdouble fdotn  UNUSED,
Mdouble fdott  UNUSED,
Vec3D P1_P2_normal_  UNUSED,
Vec3D P1_P2_tangential  UNUSED 
)
inlineprotectedvirtual

Reimplemented in StatisticsVector< T >.

Definition at line 584 of file MD.h.

Referenced by compute_internal_forces(), compute_plastic_internal_forces(), and compute_walls().

584 {};
bool MD::get_append ( )
inline

Gets restarted.

Definition at line 389 of file MD.h.

References append.

Referenced by solve(), and start_ene().

389 {return append;}
bool append
Definition: MD.h:720
Mdouble MD::get_collision_time ( Mdouble  mass,
unsigned int  indSpecies = 0 
)
inline

Calculates collision time for two copies of a particle of given disp, k, mass.

Definition at line 300 of file MD.h.

References Species.

Referenced by Chute::get_collision_time(), set_dt(), and set_dt_by_mass().

300 {return Species[indSpecies].get_collision_time(mass);}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_depth ( unsigned int  indSpecies = 0)
inline

Definition at line 198 of file MD.h.

References Species.

199  {return Species[indSpecies].get_depth();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
int MD::get_dim ( )
inline

Allows the dimension of the simulation to be accessed.

Definition at line 369 of file MD.h.

References dim.

Referenced by HGridOptimiser::Initialise(), output_xballs_data_particle(), and StatisticsVector< T >::set_nz().

369 {return dim;}
int dim
The dimension of the simulation.
Definition: MD.h:660
int MD::get_dim_particle ( unsigned int  indSpecies = 0)
inline

Allows the dimension of the particle (f.e. for mass) to be accessed.

Definition at line 263 of file MD.h.

References Species.

263 {return Species[indSpecies].get_dim_particle();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_disp ( unsigned int  indSpecies = 0)
inline

Allows the normal dissipation to be accessed.

Definition at line 239 of file MD.h.

References Species.

Referenced by Chute::readNextArgument(), and readNextArgument().

239 {return Species[indSpecies].get_dissipation();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_disprolling ( unsigned int  indSpecies = 0)
inline

Allows the tangential viscosity to be accessed.

Definition at line 230 of file MD.h.

References Species.

Referenced by readNextArgument().

230 {return Species[indSpecies].get_disprolling();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_dispt ( unsigned int  indSpecies = 0)
inline

Allows the tangential viscosity to be accessed.

Definition at line 226 of file MD.h.

References Species.

Referenced by Chute::readNextArgument(), and readNextArgument().

226 {return Species[indSpecies].get_dispt();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_disptorsion ( unsigned int  indSpecies = 0)
inline

Allows the tangential viscosity to be accessed.

Definition at line 234 of file MD.h.

References Species.

234 {return Species[indSpecies].get_disptorsion();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_dissipation ( unsigned int  indSpecies = 0)
inline

Allows the normal dissipation to be accessed.

Definition at line 243 of file MD.h.

References Species.

Referenced by Chute::set_collision_time_and_restitution_coefficient().

243 {return Species[indSpecies].get_dissipation();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
bool MD::get_do_stat_always ( )
inline

Definition at line 269 of file MD.h.

References do_stat_always.

Referenced by compute_internal_forces(), and compute_walls().

269 {return do_stat_always;}
bool do_stat_always
Definition: MD.h:683
Mdouble MD::get_dt ( )
inline

Allows the time step dt to be accessed.

Definition at line 339 of file MD.h.

References dt.

Referenced by StatisticsVector< T >::check_current_time_for_statistics(), compute_internal_forces(), compute_walls(), computeShortRangeForceWithParticle(), computeShortRangeForceWithWall(), getTangentialSpring(), getTangentialSpringWall(), load_par_ini_file(), ChuteBottom::make_rough_bottom(), and readNextArgument().

339 {return dt;}
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble MD::get_ene_ela ( )
inline

Gets ene_ela.

Definition at line 395 of file MD.h.

References ene_ela.

Referenced by output_ene().

395 {return ene_ela;}
Mdouble ene_ela
used in force calculations
Definition: MD.h:690
int MD::get_format ( )
inline

Definition at line 508 of file MD.h.

References format.

Referenced by output_xballs_data_particle().

508 {return format;}
int format
Definition: MD.h:699
Vec3D MD::get_gravity ( )
inline

Allows the gravitational acceleration to be accessed.

Definition at line 364 of file MD.h.

References gravity.

Referenced by compute_external_forces(), output_ene(), and Chute::set_ChuteAngle().

364 {return gravity;}
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
virtual bool MD::get_HGRID_UpdateEachTimeStep ( )
inlineprotectedvirtual

Definition at line 561 of file MD.h.

Referenced by do_integration_after_force_computation().

561 {return true;};
Mdouble MD::get_k ( int  indSpecies = 0)
inline

Allows the spring constant to be accessed.

Definition at line 206 of file MD.h.

References Species.

Referenced by Chute::readNextArgument(), and readNextArgument().

206 {return Species[indSpecies].get_k();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_k1 ( unsigned int  indSpecies = 0)
inline

Allows the plastic constants to be accessed.

Definition at line 192 of file MD.h.

References Species.

193  {return Species[indSpecies].get_k1();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_k2max ( unsigned int  indSpecies = 0)
inline

Definition at line 194 of file MD.h.

References Species.

Referenced by read_next_from_data_file().

195  {return Species[indSpecies].get_k2max();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_kc ( unsigned int  indSpecies = 0)
inline

Definition at line 196 of file MD.h.

References Species.

197  {return Species[indSpecies].get_kc();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_krolling ( int  indSpecies = 0)
inline

Allows the spring constant to be accessed.

Definition at line 214 of file MD.h.

References Species.

Referenced by readNextArgument().

214 {return Species[indSpecies].get_krolling();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_kt ( int  indSpecies = 0)
inline

Allows the spring constant to be accessed.

Definition at line 210 of file MD.h.

References Species.

Referenced by Chute::readNextArgument(), and readNextArgument().

210 {return Species[indSpecies].get_kt();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_ktorsion ( int  indSpecies = 0)
inline

Allows the spring constant to be accessed.

Definition at line 218 of file MD.h.

References Species.

218 {return Species[indSpecies].get_ktorsion();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_Mass_from_Radius ( Mdouble  radius,
int  indSpecies = 0 
)
inline

Definition at line 407 of file MD.h.

References BaseParticle::compute_particle_mass(), BaseParticle::get_Mass(), BaseParticle::set_IndSpecies(), BaseParticle::set_Radius(), and Species.

407  {
408  BaseParticle P;
409  P.set_Radius(radius);
410  P.set_IndSpecies(indSpecies);
412  return P.get_Mass();
413  }
void compute_particle_mass(std::vector< CSpecies > &Species)
Compute Particle mass function, which required a reference to the Species vector. It copmuters the Pa...
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble get_Mass() const
void set_IndSpecies(const int _new)
void set_Radius(const Mdouble _new)
Mdouble MD::get_max_radius ( )
inline

Sets restarted.

Get maximum radius

Definition at line 381 of file MD.h.

References max_radius.

381 {return max_radius;}
Mdouble max_radius
Definition: MD.h:665
Mdouble MD::get_maximum_velocity ( BaseParticle P)
inline

Calculates the maximum velocity allowed for a collision of two copies of P (for higher velocities particles could pass through each other)

Definition at line 416 of file MD.h.

References BaseParticle::get_IndSpecies(), BaseParticle::get_Mass(), BaseParticle::get_Radius(), and Species.

416 {return Species[P.get_IndSpecies()].get_maximum_velocity(P.get_Radius(),P.get_Mass());}
int get_IndSpecies() const
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble get_Radius() const
Mdouble get_Mass() const
Mdouble MD::get_maximum_velocity ( )
inline
Todo:
this function is dangerous since it uses particle data, which the user might not intend Calculates the maximum velocity allowed for a collision of two copies of the smallest particle (for higher velocities particles could pass through each other)

Definition at line 431 of file MD.h.

References BaseParticle::get_IndSpecies(), BaseParticle::get_Mass(), BaseParticle::get_Radius(), getSmallestParticle(), and Species.

431  {
433  return P->get_Radius() * sqrt(Species[P->get_IndSpecies()].k/(.5*P->get_Mass()));
434  }
int get_IndSpecies() const
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble get_Radius() const
Mdouble get_Mass() const
virtual BaseParticle * getSmallestParticle()
Definition: MD.h:418
CSpecies* MD::get_MixedSpecies ( int  i,
int  j 
)
inline

Allows the mixed species to be accessed.

Definition at line 131 of file MD.h.

References Species.

Referenced by compute_internal_forces(), compute_plastic_internal_forces(), and compute_walls().

131  {
132  if (i>j) return &Species[i].MixedSpecies[j];
133  else return &Species[j].MixedSpecies[i];
134  };
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_mu ( unsigned int  indSpecies = 0)
inline

Allows the Coulomb friction coefficient to be accessed.

Definition at line 247 of file MD.h.

References Species.

Referenced by read_next_from_data_file(), readNextArgument(), and solve().

247 {return Species[indSpecies].get_mu();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_murolling ( unsigned int  indSpecies = 0)
inline

Allows the Coulomb friction coefficient to be accessed.

Definition at line 251 of file MD.h.

References Species.

Referenced by readNextArgument().

251 {return Species[indSpecies].get_murolling();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_mutorsion ( unsigned int  indSpecies = 0)
inline

Allows the Coulomb friction coefficient to be accessed.

Definition at line 255 of file MD.h.

References Species.

255 {return Species[indSpecies].get_mutorsion();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
int MD::get_NSpecies ( )
inline

Allows the number of Species to be accessed.

Definition at line 123 of file MD.h.

References Species.

123 {return Species.size();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_plastic_dt ( Mdouble  mass,
unsigned int  indSpecies = 0 
)
inline

Definition at line 200 of file MD.h.

References Species.

201  {return Species[indSpecies].get_plastic_dt(mass);}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
int MD::get_restart_version ( )
inline

Gets restart_version.

Definition at line 372 of file MD.h.

References restart_version.

Referenced by Chute::read().

372 {return restart_version;}
int restart_version
Definition: MD.h:700
bool MD::get_restarted ( )
inline

Gets restarted.

Definition at line 377 of file MD.h.

References restarted.

377 {return restarted;}
bool restarted
Definition: MD.h:701
Mdouble MD::get_restitution_coefficient ( Mdouble  mass,
unsigned int  indSpecies = 0 
)
inline

Calculates restitution coefficient for two copies of given disp, k, mass.

Definition at line 302 of file MD.h.

References Species.

Referenced by Chute::get_restitution_coefficient().

302 {return Species[indSpecies].get_restitution_coefficient(mass);}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_rho ( int  indSpecies = 0)
inline

Allows the density to be accessed.

Definition at line 222 of file MD.h.

References Species.

Referenced by Chute::set_collision_time_and_restitution_coefficient().

222 {return Species[indSpecies].get_rho();}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
bool MD::get_rotation ( )
inline

Definition at line 258 of file MD.h.

References rotation.

258 {return rotation;}
bool rotation
Definition: MD.h:721
int MD::get_save_count ( )
inline

Definition at line 163 of file MD.h.

References get_save_count_data().

163 {return get_save_count_data ();}
int get_save_count_data()
Definition: MD.h:164
int MD::get_save_count_data ( )
inline

Definition at line 164 of file MD.h.

References save_count_data.

Referenced by get_save_count(), and get_savecount().

164 {return save_count_data;}
int save_count_data
These are informations for saving.
Definition: MD.h:675
int MD::get_save_count_ene ( )
inline

Definition at line 165 of file MD.h.

References save_count_ene.

165 {return save_count_ene;}
int save_count_ene
Definition: MD.h:676
int MD::get_save_count_fstat ( )
inline

Definition at line 167 of file MD.h.

References save_count_fstat.

167 {return save_count_fstat;}
int save_count_fstat
Definition: MD.h:678
int MD::get_save_count_stat ( )
inline

Definition at line 166 of file MD.h.

References save_count_stat.

166 {return save_count_stat;}
int save_count_stat
Definition: MD.h:677
bool MD::get_save_data_data ( )
inline

Returns the data counter.

Definition at line 265 of file MD.h.

References save_data_data.

265 {return save_data_data;}
bool save_data_data
Definition: MD.h:679
bool MD::get_save_data_ene ( )
inline

Definition at line 266 of file MD.h.

References save_data_ene.

Referenced by compute_internal_forces(), and compute_walls().

266 {return save_data_ene;}
bool save_data_ene
Definition: MD.h:680
bool MD::get_save_data_fstat ( )
inline

Definition at line 267 of file MD.h.

References save_data_fstat.

Referenced by compute_internal_forces(), and compute_walls().

267 {return save_data_fstat;}
bool save_data_fstat
Definition: MD.h:681
bool MD::get_save_data_stat ( )
inline

Definition at line 268 of file MD.h.

References save_data_stat.

Referenced by compute_internal_forces(), and compute_walls().

268 {return save_data_stat;}
bool save_data_stat
Definition: MD.h:682
int MD::get_savecount ( )
inline

Allows the number of time steps between saves to be accessed.

Definition at line 162 of file MD.h.

References get_save_count_data().

162 {return get_save_count_data ();}
int get_save_count_data()
Definition: MD.h:164
std::vector<CSpecies>& MD::get_Species ( void  )
inline

Allows the species to be copied.

Definition at line 126 of file MD.h.

References Species.

126 {return Species;}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
CSpecies* MD::get_Species ( int  i)
inline

Allows the species to be accessed.

Definition at line 128 of file MD.h.

References Species.

128 {return &Species[i];}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble MD::get_tmax ( )
inline

Allows the upper time limit to be accessed.

Definition at line 144 of file MD.h.

References tmax.

Referenced by Chute::cout_time(), StatisticsVector< T >::get_tmaxStat(), and readNextArgument().

144 {return tmax;}
Mdouble tmax
Definition: MD.h:672
std::string MD::get_xballs_additional_arguments ( )
inline

Definition at line 355 of file MD.h.

References xballs_additional_arguments.

std::string xballs_additional_arguments
Definition: MD.h:698
int MD::get_xballs_cmode ( )
inline

Definition at line 347 of file MD.h.

References xballs_cmode.

347 {return xballs_cmode;}
int xballs_cmode
Definition: MD.h:695
double MD::get_xballs_scale ( )
inline

Definition at line 359 of file MD.h.

References xballs_scale.

359 {return xballs_scale;}
Mdouble xballs_scale
Definition: MD.h:697
double MD::get_xballs_vscale ( )
inline

Definition at line 351 of file MD.h.

References xballs_vscale.

351 {return xballs_vscale;}
Mdouble xballs_vscale
Definition: MD.h:696
Mdouble MD::get_xmin ( )
inline

Get xmin.

Definition at line 305 of file MD.h.

References xmin.

Referenced by Chute::clean_chute(), Chute::create_bottom(), Chute::create_inflow_particle(), fstat_header(), StatisticsVector< T >::get_xminStat(), HGridOptimiser::Initialise(), load_par_ini_file(), and ChuteBottom::setup_particles_initial_conditions().

305 {return xmin;}
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
Mdouble MD::get_zmax ( )
inline
BoundaryHandler& MD::getBoundaryHandler ( )
inline

Definition at line 149 of file MD.h.

References boundaryHandler.

Referenced by Chute::setup_particles_initial_conditions(), and ChuteBottom::setup_particles_initial_conditions().

149 { return boundaryHandler;}
BoundaryHandler boundaryHandler
Definition: MD.h:709
virtual double MD::getInfo ( BaseParticle P)
inlinevirtual

Allows the user to set what is written into the info column in the data file. By default is store the Species ID number.

Definition at line 463 of file MD.h.

References BaseParticle::get_Species().

Referenced by output_xballs_data_particle().

463 {return P.get_Species();}
int get_Species() const
virtual BaseParticle* MD::getLargestParticle ( )
inlinevirtual

Reimplemented in Chute.

Definition at line 419 of file MD.h.

References ParticleHandler::getLargestParticle(), and particleHandler.

Referenced by fstat_header(), HGRID_base::InitBroadPhase(), and solve().

BaseParticle * getLargestParticle() const
Gets a pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
ParticleHandler particleHandler
Definition: MD.h:707
virtual BaseParticle* MD::getSmallestParticle ( )
inlinevirtual

Reimplemented in Chute.

Definition at line 418 of file MD.h.

References ParticleHandler::getSmallestParticle(), and particleHandler.

Referenced by fstat_header(), get_maximum_velocity(), HGRID_base::InitBroadPhase(), and set_dt().

ParticleHandler particleHandler
Definition: MD.h:707
BaseParticle * getSmallestParticle() const
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
CTangentialSpring * MD::getTangentialSpring ( BaseParticle PI,
BaseParticle PJ,
BaseParticle PJreal 
)
protected

Definition at line 706 of file MD.cc.

References CTangentialSprings::create_new(), dt, get_dt(), BaseParticle::get_Index(), get_t(), TangentialSpringParticle::get_TangentialSprings(), CTangentialSprings::select_particle_spring(), and t.

Referenced by compute_internal_forces(), and compute_plastic_internal_forces().

707 {
708  //std::cout<<"i="<<PI->get_Index()<<" j="<<PJ->get_Index()<<std::endl;
709  TangentialSpringParticle* TSParticleI=dynamic_cast<TangentialSpringParticle*>(PI);
710  TangentialSpringParticle* TSParticleJ=dynamic_cast<TangentialSpringParticle*>(PJ);
711 
712  //First check if particle I has a spring stores that is connected to particle J
713  CTangentialSpring* TangentialSpring = TSParticleI->get_TangentialSprings().select_particle_spring(PJreal->get_Index(), get_t(), get_dt());
714  if(TangentialSpring==NULL)
715  {
716  //Then check if particle J has a spring stored that is connected to particle I
717  TangentialSpring = TSParticleJ->get_TangentialSprings().select_particle_spring(PI->get_Index(), get_t(), get_dt());
718  if(TangentialSpring==NULL)
719  {
720  //A new spring has to be created, this is done in the real particle with the highest index
721  if(PI->get_Index()>PJreal->get_Index())
722  {
723  TangentialSpring = TSParticleI->get_TangentialSprings().create_new(PJreal->get_Index(), t, dt);
724  //std::cout<<"Created new spring in Particle "<<PI->get_Index()<<" between particle "<<PI->get_Index()<<" and "<<PJreal->get_Index()<<std::endl<<std::endl;
725  }
726  else
727  {
728  TangentialSpring = TSParticleJ->get_TangentialSprings().create_new(PI->get_Index(), t, dt);
729  //std::cout<<"Created new spring in Particle "<<PJ->get_Index()<<" between particle "<<PI->get_Index()<<" and "<<PJreal->get_Index()<<std::endl<<std::endl;
730  }
731  }
732  //else
733  //std::cout<<"i="<<PI->get_Index()<<" j="<<PJ->get_Index()<<" Reconnected to tangential spring in j"<<std::endl;
734  }
735  //else
736  //std::cout<<"i="<<PI->get_Index()<<" j="<<PJ->get_Index()<<" Reconnected to tangential spring in i"<<std::endl;
737  return TangentialSpring;
738 }
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
int get_Index() const
CTangentialSprings & get_TangentialSprings()
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
Mdouble t
This stores the current time.
Definition: MD.h:687
Stores the tangential spring needed to compute a tangential elastic force between particles PI...
CTangentialSpring * create_new(int P, Mdouble time_, Mdouble dt)
CTangentialSpring * select_particle_spring(int P, Mdouble time_, Mdouble dt)
Function selects the tangential spring vector for particle-particle interations (also removed not use...
CTangentialSpring * MD::getTangentialSpringWall ( BaseParticle pI,
int  w 
)
protected

Definition at line 741 of file MD.cc.

References CTangentialSprings::create_new_wall(), dt, get_dt(), get_t(), TangentialSpringParticle::get_TangentialSprings(), CTangentialSprings::select_wall_spring(), and t.

Referenced by compute_walls().

742 {
743  TangentialSpringParticle* TSParticle=dynamic_cast<TangentialSpringParticle*>(pI);
744  CTangentialSpring* TangentialSpring = TSParticle->get_TangentialSprings().select_wall_spring(w, get_t(), get_dt());
745 
746  if(TangentialSpring==NULL)
747  TangentialSpring = TSParticle->get_TangentialSprings().create_new_wall(w, t, dt);
748 
749  return TangentialSpring;
750 }
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
CTangentialSprings & get_TangentialSprings()
CTangentialSpring * select_wall_spring(int W, Mdouble time_, Mdouble dt)
Function selects the tangential spring vector for particle-particle interations (also removed not use...
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
Mdouble t
This stores the current time.
Definition: MD.h:687
Stores the tangential spring needed to compute a tangential elastic force between particles PI...
CTangentialSpring * create_new_wall(int W, Mdouble time_, Mdouble dt)
WallHandler& MD::getWallHandler ( )
inline
virtual void MD::HGRID_actions_after_integration ( )
inlineprotectedvirtual

Reimplemented in HGRID_base.

Definition at line 596 of file MD.h.

Referenced by solve().

596 {};
virtual void MD::HGRID_actions_before_integration ( )
inlineprotectedvirtual

Reimplemented in HGRID_base.

Definition at line 595 of file MD.h.

Referenced by solve().

595 {};
virtual void MD::HGRID_actions_before_time_loop ( )
inlineprotectedvirtual

This is actions before the start of the main time loop.

Reimplemented in HGRID_base.

Definition at line 552 of file MD.h.

Referenced by solve(), and statistics_from_restart_data().

552 {};
virtual void MD::HGRID_actions_before_time_step ( )
inlineprotectedvirtual

This is action before the time step is started.

Reimplemented in HGRID_base.

Definition at line 555 of file MD.h.

Referenced by solve(), and statistics_from_restart_data().

555 {};
virtual void MD::HGRID_InsertParticleToHgrid ( BaseParticle *obj  UNUSED)
inlineprotectedvirtual

This is action before the time step is started.

Definition at line 558 of file MD.h.

558 {};
virtual void MD::HGRID_RemoveParticleFromHgrid ( BaseParticle *obj  UNUSED)
inlineprotectedvirtual

Definition at line 560 of file MD.h.

Referenced by do_integration_after_force_computation(), and removeParticle().

560 {};
virtual void MD::HGRID_update_move ( BaseParticle ,
Mdouble   
)
inlineprotectedvirtual

Reimplemented in HGRID_base.

Definition at line 594 of file MD.h.

Referenced by do_integration_before_force_computation().

594 {};
virtual void MD::HGRID_UpdateParticleInHgrid ( BaseParticle *obj  UNUSED)
inlineprotectedvirtual
void MD::info ( )
inlinevirtual

Set up a virtual info this will be provided from the inhertiance.

Reimplemented from STD_save.

Definition at line 93 of file MD.h.

References print().

93 {print(std::cout);}
virtual void print(std::ostream &os, bool print_all=false)
Outputs MD.
Definition: MD.cc:1806
virtual void MD::InitBroadPhase ( )
inlineprotectedvirtual

Initialisation of Broad Phase Information (Default no Broad Phase so empty)

Reimplemented in HGRID_base.

Definition at line 602 of file MD.h.

602 {};
virtual void MD::initialize_statistics ( )
inlineprotectedvirtual

Functions for statistics.

Reimplemented in StatisticsVector< T >.

Definition at line 582 of file MD.h.

Referenced by solve(), and statistics_from_restart_data().

582 {};
void MD::initialize_tangential_springs ( )
protected
bool MD::load_from_data_file ( const char *  filename,
unsigned int  format = 0 
)

This allows particle data to be reloaded from data files.

This function loads data from the .data file i.e.

you get position, mass and velocity information only See also MD::load_restart_data Can read in format 14 - 8 or format 7 data This code saves in format 8 for 2D and format 14 for 3D so if no extra parameters are specified it will assume this note: many parameters, like density cannot be set using the data file

Todo:
change from deprecated const char* to std::string

Definition at line 250 of file MD.cc.

References STD_save::data_file, STD_save::get_options_data(), STD_save::options_data, read_next_from_data_file(), and STD_save::set_options_data().

Referenced by readNextArgument(), and statistics_from_restart_data().

251 {
252  //This opens the file the data will be recalled from
253  data_file.open( filename, std::fstream::in);
254  if (!data_file.is_open()||data_file.bad()) {
255  std::cout << "Loading data file " << filename << " failed" << std::endl;
256  return false;
257  }
258 
259  //options_data is ignored
261  set_options_data(1);
262  read_next_from_data_file(format);
263  set_options_data(options_data);
264 
265  data_file.close();
266 
267  //std::cout << "Loaded data file " << filename << " (t=" << get_t() << ")" << std::endl;
268  return true;
269 }
void set_options_data(unsigned int new_)
Definition: STD_save.h:161
std::fstream data_file
Stream used for data files.
Definition: STD_save.h:252
unsigned int get_options_data(void)
Definition: STD_save.h:162
unsigned int options_data
Definition: STD_save.h:263
bool read_next_from_data_file(unsigned int format=0)
by default format do not pass an argument; only specify format if you have to read a special format (...
Definition: MD.cc:453
bool MD::load_par_ini_file ( const char *  filename)

allows the user to read par.ini files (useful to read MDCLR files)

Definition at line 271 of file MD.cc.

References boundaryHandler, BaseHandler< T >::copyAndAddObject(), WallHandler::copyAndAddWall(), get_dt(), get_xmax(), get_xmin(), get_ymax(), get_ymin(), get_zmax(), get_zmin(), PeriodicBoundary::set(), InfiniteWall::set(), set_dim_particle(), set_disp(), set_dt(), set_gravity(), set_k(), set_rho(), set_save_count_data(), set_save_count_fstat(), set_savecount(), set_t(), set_tmax(), and wallHandler.

272 {
273  //Opens the par.ini file
274  std::fstream file;
275  file.open( filename, std::fstream::in);
276  if (!file.is_open()||file.bad()) {
277  //std::cout << "Loading par.ini file " << filename << " failed" << std::endl;
278  return false;
279  }
280 
281  Mdouble doubleValue;
282  int integerValue;
283 
284  // inputfile par.ini
285  // line 1 =============================================================
286  // Example: 1 1 0
287  // 1: integer (0|1) switches from non-periodic to periodic
288  // integer (5|6) does 2D integration only (y-coordinates fixed)
289  // and switches from non-periodic to periodic
290  // integer (11) uses a quarter system with circular b.c.
291  file >> integerValue;
292  //~ std::cout << "11" << integerValue << std::endl;
293  if (integerValue==0)
294  {
295  InfiniteWall w0;
296  w0.set(Vec3D(-1,0,0), -get_xmin());
298  w0.set(Vec3D( 1,0,0), get_xmax());
300  w0.set(Vec3D( 0,-1,0), -get_ymin());
302  w0.set(Vec3D(0, 1,0), get_ymax());
304  w0.set(Vec3D(0,0,-1), -get_zmin());
306  w0.set(Vec3D(0,0,1), get_zmax());
308  }
309  else if (integerValue==1)
310  {
311  PeriodicBoundary b0;
312  b0.set(Vec3D(1,0,0), get_xmin(), get_xmax());
314  b0.set(Vec3D(0,1,0), get_ymin(), get_ymax());
316  b0.set(Vec3D(0,0,1), get_zmin(), get_zmax());
318  }
319  else if (integerValue==5)
320  {
321  InfiniteWall w0;
322  w0.set(Vec3D(-1,0,0), -get_xmin());
324  w0.set(Vec3D( 1,0,0), get_xmax());
326  w0.set(Vec3D( 0,-1,0), -get_ymin());
328  w0.set(Vec3D(0, 1,0), get_ymax());
330 
331 
332  }
333  else if (integerValue==6)
334  {
335  PeriodicBoundary b0;
336  b0.set(Vec3D(1,0,0), get_xmin(), get_xmax());
338  b0.set(Vec3D(0,1,0), get_ymin(), get_ymax());
340  b0.set(Vec3D(0,0,1), get_zmin(), get_zmax());
342  }
343  else
344  {
345  std::cerr << "Error in par.ini: line 1, value 1 is " << integerValue << std::endl;
346  exit(-1);
347  }
348 
349  // 2: integer (0|1) dont use | use the search pattern for linked cells
350  file >> integerValue; //ignore
351 
352  // 3: real - gravity in z direction: positive points upwards
353  file >> doubleValue;
354  set_gravity(Vec3D(0.0,0.0,doubleValue));
355 
356  // line 2 =============================================================
357  // Example: -10000 .5e-2
358  // 1: time end of simulation - (negative resets start time to zero
359  // and uses -time as end-time)
360  file >> doubleValue;
361  if (doubleValue<0) set_t(0);
362  set_tmax(fabs(doubleValue));
363 
364  // 2: time-step of simulation
365  file >> doubleValue;
366  set_dt(doubleValue);
367 
368  // line 3 =============================================================
369  // Example: 1e-1 100
370  file >> doubleValue;
371  if (doubleValue>=0) {
372  // 1: time-step for output on time-series protocoll file -> "ene"
373  int savecount = round(doubleValue/get_dt());
374  set_savecount(savecount);
375 
376  // 2: time-step for output on film (coordinate) file -> "c3d"
377  // (fstat-output is coupled to c3d-output time-step)
378  file >> doubleValue;
379  savecount = round(doubleValue/get_dt());
380  set_save_count_data(savecount);
381  set_save_count_fstat(savecount);
382  } else {
383  // or: ---------------------------------------------------------------
384  // 1: negative number is multiplied to the previous log-output-time
385  // 2: requires initial log-output time
386  // 3: negative number is multiplied to the previous film-output-time
387  // 4: requires initial film-output time
388  std::cerr << "Error in par.ini: line 3, value 1 is " << doubleValue << std::endl;
389  exit(-1);
390  }
391 
392  // line 4 =============================================================
393  // Example: 2000 1e5 1e3 1e2
394  // 1: particle density (mass=4/3*constants::pi*density*rad^3)
395  file >> doubleValue;
396  set_dim_particle(3);
397  set_rho(doubleValue);
398 
399  // 2: linear spring constant
400  file >> doubleValue;
401  set_k(doubleValue);
402 
403  // 3: linear dashpot constant
404  file >> doubleValue;
405  set_disp(doubleValue);
406 
407  // 4: background damping dashpot constant
408  file >> doubleValue;
409  if (doubleValue) std::cerr << "Warning in par.ini: ignored background damping " << doubleValue << std::endl;
410 
411  // line 5 =============================================================
412  // Example: 0 0
413  // 1: growth rate: d(radius) = xgrow * dt
414  file >> doubleValue;
415  if (doubleValue) std::cerr << "Warning in par.ini: ignored growth rate " << doubleValue << std::endl;
416 
417  // 2: target volume_fraction
418  file >> doubleValue;
419  if (doubleValue) std::cerr << "Warning in par.ini: ignored target volume_fraction " << doubleValue << std::endl;
420 
421  file.close();
422  //std::cout << "Loaded par.ini file " << filename << std::endl;
423  return true;
424 }
Mdouble get_zmin()
Gets zmin.
Definition: MD.h:313
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
void copyAndAddObject(const T &O)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:93
void set_dt()
Sets dt to 1/50-th of the smallest possible collision time.
Definition: MD.h:447
void set_savecount(int new_)
Allows the number of time steps between saves to be changed, see also set_number_of_saves.
Definition: MD.h:155
void set_tmax(Mdouble new_tmax)
Allows the upper time limit to be changed.
Definition: MD.h:142
void set_t(Mdouble new_t)
Access function for the time.
Definition: MD.h:110
Mdouble get_ymax()
Gets ymax.
Definition: MD.h:311
WallHandler wallHandler
Definition: MD.h:708
Defines a pair of periodic walls. The particles are in {x: position_left<=normal*x
void set_save_count_fstat(int new_)
Definition: MD.h:160
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble get_ymin()
Gets ymin.
Definition: MD.h:309
Mdouble get_xmin()
Get xmin.
Definition: MD.h:305
void copyAndAddWall(const BaseWall &B)
Creates a copy of a BaseWall and adds it to the WallHandler.
Definition: WallHandler.cc:84
double Mdouble
Definition: ExtendedMath.h:33
void set_save_count_data(int new_)
Definition: MD.h:157
void set_dim_particle(int new_, unsigned int indSpecies=0)
Allows the dimension of the particle (f.e. for mass) to be changed.
Definition: MD.h:261
void set(Vec3D normal_, Mdouble position_)
Defines a standard wall, given an outward normal vector s. t. normal*x=position.
Definition: InfiniteWall.h:75
void set_rho(Mdouble new_, unsigned int indSpecies=0)
Allows the density to be changed.
Definition: MD.h:220
This is a class defining walls.
Definition: InfiniteWall.h:42
void set(Vec3D normal_, Mdouble position_left_, Mdouble position_right_)
Defines a periodic wall, given a normal vector s.t.
Mdouble get_xmax()
Get xmax.
Definition: MD.h:307
void set_gravity(Vec3D new_gravity)
Allows the gravitational acceleration to be changed.
Definition: MD.h:362
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble get_zmax()
Gets zmax.
Definition: MD.h:315
void set_k(Mdouble new_, unsigned int indSpecies=0)
Allows the spring constant to be changed.
Definition: MD.h:204
void set_disp(Mdouble new_, unsigned int indSpecies=0)
Allows the normal dissipation to be changed.
Definition: MD.h:237
int MD::load_restart_data ( )

Loads all MD data.

This function loads all MD data - See also MD::save_restart_data, MD::load_from_data_file This function return 1 if sucessful else it returns -1.

Definition at line 685 of file MD.cc.

References STD_save::problem_name.

Referenced by readNextArgument(), and statistics_from_restart_data().

685  {
686  std::stringstream restart_filename;
687  restart_filename.str("");
688  restart_filename << problem_name.str().c_str() << ".restart";
689  return load_restart_data(restart_filename.str());
690 }
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
int load_restart_data()
Loads all MD data.
Definition: MD.cc:685
int MD::load_restart_data ( std::string  filename)

Definition at line 692 of file MD.cc.

References read(), and set_restarted().

692  {
693  std::ifstream restart_data(filename.c_str());
694  if( restart_data.good() )
695  {
696  read(restart_data);
697  restart_data.close();
698  set_restarted(true);
699  return(1);
700  } else {
701  std::cerr << "restart_data " << filename << " could not be loaded from " << filename << std::endl;
702  exit(-1);
703  }
704 }
void set_restarted(bool new_)
Definition: MD.h:383
virtual void read(std::istream &is)
Reads all MD data.
Definition: MD.cc:2026
void MD::output_ene ( )
protectedvirtual

This function outputs statistical data - The default is to compute the rotational kinetic engergy, linear kinetic energy, and the centre of mass.

todo{Why is there a +6 here?}

Definition at line 175 of file MD.cc.

References BaseHandler< T >::end(), STD_save::ene_file, get_ene_ela(), get_gravity(), get_t(), getParticleHandler(), and set_ene_ela().

Referenced by solve(), and statistics_from_restart_data().

176 {
177  Mdouble ene_kin = 0, ene_rot = 0, ene_gra = 0, mass_sum= 0, x_masslength=0, y_masslength=0, z_masslength=0;
178 
179  for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) if (!(*it)->isFixed())
180  {
181  ene_kin += .5 * (*it)->get_Mass() * (*it)->get_Velocity().GetLength2();
182  ene_rot += .5 * (*it)->get_Inertia() * (*it)->get_AngularVelocity().GetLength2();
183  ene_gra -= (*it)->get_Mass() * Dot(get_gravity(),(*it)->get_Position());
184  mass_sum+= (*it)->get_Mass();
185  x_masslength +=(*it)->get_Mass()*(*it)->get_Position().X;
186  y_masslength +=(*it)->get_Mass()*(*it)->get_Position().Y;
187  z_masslength +=(*it)->get_Mass()*(*it)->get_Position().Z;
188  } //end for loop over Particles
189 
191  static int width = ene_file.precision() + 6;
192  ene_file << std::setw(width) << get_t()
193  << " " << std::setw(width) << ene_gra
194  << " " << std::setw(width) << ene_kin
195  << " " << std::setw(width) << ene_rot
196  << " " << std::setw(width) << get_ene_ela()
197  << " " << std::setw(width) << (mass_sum?x_masslength/mass_sum:std::numeric_limits<double>::quiet_NaN())
198  << " " << std::setw(width) << (mass_sum?y_masslength/mass_sum:std::numeric_limits<double>::quiet_NaN())
199  << " " << std::setw(width) << (mass_sum?z_masslength/mass_sum:std::numeric_limits<double>::quiet_NaN())
200  << std::endl;
201 
202  set_ene_ela(0);
203  //sliding = sticking = 0;
204 }
void set_ene_ela(Mdouble new_)
Sets ene_ela.
Definition: MD.h:397
Mdouble get_ene_ela()
Gets ene_ela.
Definition: MD.h:395
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
double Mdouble
Definition: ExtendedMath.h:33
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:233
ParticleHandler & getParticleHandler()
Definition: MD.h:147
Vec3D get_gravity()
Allows the gravitational acceleration to be accessed.
Definition: MD.h:364
std::fstream ene_file
Definition: STD_save.h:255
virtual void MD::output_statistics ( )
inlineprotectedvirtual

Reimplemented in StatisticsVector< T >.

Definition at line 583 of file MD.h.

Referenced by solve().

583 {};
void MD::output_xballs_data ( )
protectedvirtual

Output xball data for Particle i.

This function outputs the location and velocity of the particle in a format the xballs progream can read.

Definition at line 209 of file MD.cc.

References STD_save::data_file, dim, format, BaseHandler< T >::getNumberOfObjects(), output_xballs_data_particle(), particleHandler, t, xmax, xmin, ymax, ymin, zmax, and zmin.

Referenced by solve(), and StatisticsVector< T >::statistics_from_p3().

210 {
211  //Set the correct formation based of dimension if the formation is not specified by the user
212  if (format ==0) {
213  switch (dim) {
214  case 1:
215  case 2:
216  format=8;
217  break;
218  case 3:
219  format=14;
220  break;
221  }
222  }
223 
224  // This outputs the location of walls and how many particles there are to file this is required by the xballs plotting
225  if (format!=14) // dim = 1 or 2
226  data_file << particleHandler.getNumberOfObjects() << " " <<t << " "
227  << xmin << " " << ymin << " "
228  << xmax << " " << ymax << " " << std::endl;
229  else //dim==3
230  data_file << particleHandler.getNumberOfObjects() << " " <<t << " "
231  << xmin << " " << ymin << " " << zmin << " "
232  << xmax << " " << ymax << " " << zmax << " " << std::endl;
233  // This outputs the particle data
234  for (unsigned int i = 0;i<particleHandler.getNumberOfObjects();i++)
236  #ifdef DEBUG_OUTPUT
237  std::cerr << "Have output the properties of the problem to disk " << std::endl;
238  #endif
239 }
int format
Definition: MD.h:699
int dim
The dimension of the simulation.
Definition: MD.h:660
std::fstream data_file
Stream used for data files.
Definition: STD_save.h:252
ParticleHandler particleHandler
Definition: MD.h:707
virtual void output_xballs_data_particle(int i)
This function outputs the location and velocity of the particle in a format the xballs progream can r...
Definition: MD_xballs.icc:30
Mdouble xmax
Definition: MD.h:668
Mdouble t
This stores the current time.
Definition: MD.h:687
Mdouble zmax
Definition: MD.h:668
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
void MD::output_xballs_data_particle ( int  i)
protectedvirtual

This function outputs the location and velocity of the particle in a format the xballs progream can read.

Todo:
{changes in *.icc files are not immediately regognized by the makefile!}

Definition at line 30 of file MD_xballs.icc.

References STD_save::data_file, BaseParticle::get_Angle(), BaseParticle::get_AngularVelocity(), get_dim(), get_format(), BaseParticle::get_Position(), BaseParticle::get_Radius(), BaseParticle::get_Velocity(), getInfo(), BaseHandler< T >::getObject(), getParticleHandler(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

Referenced by output_xballs_data().

31 {
32  //data_file.precision(14);
34  //This outputs the data about particle i again to the file.
35  switch(get_format())
36  {
37  case 8:
38  {
39  if (get_dim()==1) {
41  break;
42  } else {
43  data_file
44  << getParticleHandler().getObject(i)->get_Position().X << " "
45  << getParticleHandler().getObject(i)->get_Position().Y << " "
46  << getParticleHandler().getObject(i)->get_Velocity().X << " "
47  << getParticleHandler().getObject(i)->get_Velocity().Y << " "
48  << getParticleHandler().getObject(i)->get_Radius() << " "
49  << -getParticleHandler().getObject(i)->get_Angle().Z << " " // negative b/c we are plotting (x,y) coordinates on the xz-axis of xballs
51  << getInfo(*getParticleHandler().getObject(i)) <<std::endl;
52  }
53  break;
54  }
55  case 14:
56  {
57  data_file
58  << getParticleHandler().getObject(i)->get_Position().X << " "
59  << getParticleHandler().getObject(i)->get_Position().Y << " "
60  << getParticleHandler().getObject(i)->get_Position().Z << " "
61  << getParticleHandler().getObject(i)->get_Velocity().X << " "
62  << getParticleHandler().getObject(i)->get_Velocity().Y << " "
63  << getParticleHandler().getObject(i)->get_Velocity().Z << " "
64  << getParticleHandler().getObject(i)->get_Radius() << " "
65  << getParticleHandler().getObject(i)->get_Angle().X << " " // negative b/c we are plotting (x,y) coordinates on the xz-axis of xballs
66  << getParticleHandler().getObject(i)->get_Angle().Y << " " // negative b/c we are plotting (x,y) coordinates on the xz-axis of xballs
67  << getParticleHandler().getObject(i)->get_Angle().Z << " " // negative b/c we are plotting (x,y) coordinates on the xz-axis of xballs
71  << getInfo(*getParticleHandler().getObject(i)) <<std::endl;
72  break;
73  } //end case 3
74  default:
75  {
76  std::cerr << "format not found" << std::endl;
77  }
78  } //end switch statement
79 }
Mdouble X
Definition: Vector.h:44
const Vec3D & get_Velocity() const
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
int get_dim()
Allows the dimension of the simulation to be accessed.
Definition: MD.h:369
Mdouble get_Radius() const
std::fstream data_file
Stream used for data files.
Definition: STD_save.h:252
const Vec3D & get_Position() const
Mdouble Y
Definition: Vector.h:44
int get_format()
Definition: MD.h:508
ParticleHandler & getParticleHandler()
Definition: MD.h:147
const Vec3D & get_Angle() const
virtual double getInfo(BaseParticle &P)
Allows the user to set what is written into the info column in the data file. By default is store the...
Definition: MD.h:463
Mdouble Z
Definition: Vector.h:44
const Vec3D & get_AngularVelocity() const
void MD::print ( std::ostream &  os,
bool  print_all = false 
)
virtual

Outputs MD.

Reimplemented in ChuteWithHopperAndInset, Chute, and HGRID_base.

Definition at line 1806 of file MD.cc.

References boundaryHandler, dim, dt, BaseHandler< T >::getNumberOfObjects(), WallHandler::getNumberOfWalls(), BaseHandler< T >::getObject(), BaseHandler< T >::getStorageCapacity(), WallHandler::getWall(), gravity, STD_save::options_data, STD_save::options_ene, STD_save::options_fstat, STD_save::options_restart, particleHandler, BaseBoundary::print(), BaseParticle::print(), BaseWall::print(), STD_save::problem_name, save_count_data, save_count_ene, save_count_fstat, save_count_stat, Species, t, tmax, wallHandler, xmax, xmin, ymax, ymin, zmax, and zmin.

Referenced by info(), HGRID_base::print(), StatisticsVector< T >::statistics_from_fstat_and_data(), and StatisticsVector< T >::statistics_from_p3().

1806  {
1807  os << "problem_name:" << problem_name.str().c_str() << std::endl;
1808  os << " t:" << t << " dt:" << dt << ", tmax:" << tmax << ", save_count_data:" << save_count_data << ", save_count_ene:" << save_count_ene << ", save_count_stat:" << save_count_stat << ", save_count_fstat:" << save_count_fstat << std::endl;
1809  os << " x:[" << xmin << "," << xmax << "], y:[" << ymin << "," << ymax << "], z:[" << zmin << "," << zmax << "]" << std::endl;
1810  os << " dim:" << dim << ", gravity:" << gravity << std::endl;
1811  if (Species.size()==1) {
1812  os << " "; Species[0].print(os); os << std::endl;
1813  } else {
1814  os << " Species: size:" << Species.size() << std::endl;
1815  for (unsigned int i=0; i<Species.size(); i++) {
1816  os << " "; Species[i].print(os); os << std::endl;
1817  for (unsigned int j=0; j<Species[i].MixedSpecies.size(); j++) { os << " "; Species[i].MixedSpecies[j].print(os); os << std::endl; }
1818  }
1819  }
1820  os << " options_fstat=" << options_fstat
1821  << " , options_data=" << options_data
1822  << " , options_ene=" << options_ene
1823  << " , options_restart=" << options_restart << std::endl;
1824  os << " Particles: N:" << particleHandler.getNumberOfObjects() << ", Nmax:" << particleHandler.getStorageCapacity() << std::endl;
1825  if (print_all) for (unsigned int i=0; i<particleHandler.getNumberOfObjects(); i++) { os << " "; particleHandler.getObject(i)->print(os); os << std::endl; }
1826  os << " Walls: NWall:" << wallHandler.getNumberOfWalls() << ", NBoundary:" << boundaryHandler.getNumberOfObjects() << std::endl;
1827  for (unsigned int i=0; i<wallHandler.getNumberOfWalls(); i++) { os << " "; wallHandler.getWall(i)->print(os); os << std::endl; }
1828  for (unsigned int i=0; i<boundaryHandler.getNumberOfObjects(); i++) { os << " "; boundaryHandler.getObject(i)->print(os); os << std::endl; }
1829  }
unsigned int options_restart
Definition: STD_save.h:266
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
unsigned int options_fstat
Indicators if files are created or not 0: file will not be created 1: file will be written in one fil...
Definition: STD_save.h:262
int dim
The dimension of the simulation.
Definition: MD.h:660
virtual void print(std::ostream &os) const
Particle print function, which accepts an os std::stringstream as input.
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
WallHandler wallHandler
Definition: MD.h:708
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble xmax
Definition: MD.h:668
Mdouble t
This stores the current time.
Definition: MD.h:687
int save_count_ene
Definition: MD.h:676
Mdouble zmax
Definition: MD.h:668
unsigned int getNumberOfWalls() const
Gets the number of BaseWalls in this WallHandler.
Definition: WallHandler.cc:224
unsigned int options_ene
Definition: STD_save.h:265
virtual void print(std::ostream &os UNUSED) const =0
outputs boundary
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
int save_count_stat
Definition: MD.h:677
virtual void print(std::ostream &os UNUSED) const =0
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
int save_count_fstat
Definition: MD.h:678
Mdouble tmax
Definition: MD.h:672
unsigned int getStorageCapacity() const
Gets the storage capacity of this BaseHandler.
Definition: BaseHandler.h:206
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
BaseWall * getWall(const unsigned int id) const
Gets a pointer to the BaseWall at the specified index in the WallHandler.
Definition: WallHandler.cc:203
unsigned int options_data
Definition: STD_save.h:263
int save_count_data
These are informations for saving.
Definition: MD.h:675
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
virtual void MD::process_statistics ( bool usethese  UNUSED)
inlineprotectedvirtual

Reimplemented in StatisticsVector< T >.

Definition at line 585 of file MD.h.

Referenced by solve().

585 {};
void MD::read ( std::istream &  is)
virtual

Reads all MD data.

Reimplemented in ChuteWithHopper, ChuteWithHopperAndInset, Chute, and HGRID_base.

Definition at line 2026 of file MD.cc.

References boundaryHandler, WallHandler::clear(), ParticleHandler::clear(), BaseHandler< T >::clear(), BaseParticle::compute_particle_mass(), data_FixedParticles, dim, dt, BaseHandler< T >::getLastObject(), getLineFromStringStream(), gravity, STD_save::options_data, STD_save::options_ene, STD_save::options_fstat, STD_save::options_restart, particleHandler, STD_save::problem_name, read_v1(), read_v2(), BoundaryHandler::readObject(), ParticleHandler::readObject(), WallHandler::readWall(), restart_version, save_count_data, save_count_ene, save_count_fstat, save_count_stat, Species, t, tmax, wallHandler, xmax, xmin, ymax, ymin, zmax, and zmin.

Referenced by load_restart_data(), and HGRID_base::read().

2027 {
2028  std::string dummy;
2029  is >> dummy;
2030  if (strcmp(dummy.c_str(),"restart_version"))
2031  {
2032  dim = atoi(dummy.c_str());
2033  restart_version = 1;
2034  read_v1(is);
2035  }
2036  else
2037  {
2038  is >> restart_version
2039  >> dummy >> dummy;
2040  problem_name.str(dummy);
2041  if(restart_version==2)
2042  {
2043  read_v2(is);
2044  }
2045  else
2046  {
2047  //std::cout << "version 3" << std::endl;
2048  is >> dummy >> xmin
2049  >> dummy >> xmax
2050  >> dummy >> ymin
2051  >> dummy >> ymax
2052  >> dummy >> zmin
2053  >> dummy >> zmax
2054  >> dummy >> dt
2055  >> dummy >> t
2056  >> dummy >> tmax
2057  >> dummy >> save_count_data
2058  >> dummy >> save_count_ene
2059  >> dummy >> save_count_stat
2060  >> dummy >> save_count_fstat
2061  >> dummy >> dim
2062  >> dummy >> gravity
2063  >> dummy >> options_fstat
2064  >> dummy >> options_data
2065  >> dummy >> options_ene
2066  >> dummy;
2067  //this is optional to allow restart files with and without options_restart
2068  if (!strcmp(dummy.c_str(),"options_restart")) is >> options_restart >> dummy;
2069  unsigned int N;
2070  is >> N;
2071  Species.resize(0); //to clear the Species vector
2072  Species.resize(N);
2073  //please don't change this code to iterators; the mixed species requires indexing
2074  //old code: for (vector<CSpecies>::iterator it = Species.begin(); it!=Species.end(); ++it) it->read(is);
2075  for (unsigned int i=0; i<N; i++) {
2076  Species[i].read(is);
2077  Species[i].MixedSpecies.resize(i);
2078  for (unsigned int j=0; j<i; j++) {
2079  Species[i].MixedSpecies[j].read(is);
2080  }
2081  }
2082 
2083  std::stringstream line (std::stringstream::in | std::stringstream::out);
2084 
2085  is >> dummy >> N;
2086  wallHandler.clear();
2087  getLineFromStringStream(is,line);
2088  for (unsigned int i=0;i<N;i++)
2089  {
2090  getLineFromStringStream(is,line);
2091  wallHandler.readWall(line);
2092  }
2093 
2094  is >> dummy >> N;
2096  getLineFromStringStream(is,line);
2097  for (unsigned int i=0;i<N;i++)
2098  {
2099  getLineFromStringStream(is,line);
2101  }
2102 
2103  is >> dummy >> N;
2105  getLineFromStringStream(is,line);
2106  for (unsigned int i=0;i<N;i++)
2107  {
2108  getLineFromStringStream(is,line);
2111  }
2112 
2113  //After the lines storing particle data, an optional variable 'FixedParticles' can be read in, which fixes the first 'FixedParticles' particles
2114  if (is.peek()==70) is >> dummy >> data_FixedParticles;
2115  }
2116  }
2117 }
unsigned int options_restart
Definition: STD_save.h:266
void readWall(std::istream &is)
Reads BaseWall into the WallHandler from restart data.
Definition: WallHandler.cc:133
virtual void read_v1(std::istream &is)
Reads all MD data.
Definition: MD.cc:2217
void compute_particle_mass(std::vector< CSpecies > &Species)
Compute Particle mass function, which required a reference to the Species vector. It copmuters the Pa...
void getLineFromStringStream(std::istream &in, std::stringstream &out)
T * getLastObject() const
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:192
unsigned int options_fstat
Indicators if files are created or not 0: file will not be created 1: file will be written in one fil...
Definition: STD_save.h:262
int dim
The dimension of the simulation.
Definition: MD.h:660
void readObject(std::istream &is)
Reads BaseParticle into the ParticleHandler from restart data.
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
WallHandler wallHandler
Definition: MD.h:708
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
void clear()
Empties the whole ParticleHandler by removing all BaseParticle.
int restart_version
Definition: MD.h:700
void readObject(std::istream &is)
Reads BaseBoundary into the BoundaryHandler from restart data.
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble xmax
Definition: MD.h:668
Mdouble t
This stores the current time.
Definition: MD.h:687
int save_count_ene
Definition: MD.h:676
Mdouble zmax
Definition: MD.h:668
unsigned int options_ene
Definition: STD_save.h:265
int save_count_stat
Definition: MD.h:677
virtual void read_v2(std::istream &is)
Definition: MD.cc:2121
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
int save_count_fstat
Definition: MD.h:678
Mdouble tmax
Definition: MD.h:672
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
unsigned int options_data
Definition: STD_save.h:263
int save_count_data
These are informations for saving.
Definition: MD.h:675
Mdouble ymin
Definition: MD.h:668
void clear()
Empties the whole WallHandler by removing all BaseWall.
Definition: WallHandler.cc:127
void clear()
Empties the whole BaseHandler by removing all Object.
Definition: BaseHandler.h:162
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
int data_FixedParticles
Definition: MD.h:702
int MD::read_dim_from_data_file ( )

Definition at line 628 of file MD.cc.

References STD_save::data_file, STD_save::data_filename, t, xmax, xmin, ymax, ymin, zmax, and zmin.

629 {
630  //This opens the file the data will be recalled from; note that data_filename needs to be set
631  std::fstream file;
632  file.open( data_filename.str().c_str() , std::fstream::in);
633 
634  //read first line and close file
635  std::string header_string;
636  getline(data_file,header_string);
637  std::stringstream header (std::stringstream::in | std::stringstream::out);
638  header << header_string;
639  file.close();
640 
641  //extract data from first line
642  Mdouble N, t, xmin, ymin, zmin, xmax, ymax, zmax;
643  header >> N >> t >> xmin >> ymin >> zmin >> xmax >> ymax >> zmax;
644 
645  //Set the correct formation based of dimension if the formation is not specified by the user
646  if (header.eof()) return 2;
647  else return 3;
648 }
std::stringstream data_filename
These store the save file names, by default they are derived from problem_name.
Definition: STD_save.h:246
std::fstream data_file
Stream used for data files.
Definition: STD_save.h:252
Mdouble xmax
Definition: MD.h:668
Mdouble t
This stores the current time.
Definition: MD.h:687
Mdouble zmax
Definition: MD.h:668
double Mdouble
Definition: ExtendedMath.h:33
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
bool MD::read_next_from_data_file ( unsigned int  format = 0)

by default format do not pass an argument; only specify format if you have to read a special format (f.e. dim=2, but format=14 (3d format))

Todo:
{TW: what if mu=0, but get_Species(1).mu isn't? We have to check all mu, right?}
Todo:
{TW: also plastic particles have to be checked.}

Definition at line 453 of file MD.cc.

References BaseHandler< T >::begin(), BaseHandler< T >::copyAndAddObject(), STD_save::data_file, data_FixedParticles, dim, BaseHandler< T >::end(), BaseParticle::fixParticle(), get_k2max(), get_mu(), STD_save::get_options_data(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), STD_save::increase_counter_data(), particleHandler, BaseHandler< T >::removeLastObject(), reset_TangentialSprings(), Species, t, Vec3D::X, xmax, xmin, Vec3D::Y, ymax, ymin, Vec3D::Z, zmax, and zmin.

Referenced by load_from_data_file(), and StatisticsVector< T >::read_next_from_data_file().

454 {
455  if (get_options_data()==2) increase_counter_data(std::fstream::in);
456 
457 
458 
459  //Set the correct formation based of dimension if the formation is not specified by the user
460  if (format ==0)
461  {
462  switch (dim)
463  {
464  case 1:
465  case 2:
466  format=8;
467  break;
468  case 3:
469  format=14;
470  break;
471  }
472  //end case
473 
474  }
475  //end if
476 
477  static unsigned int N;
478  static Mdouble dummy;
479 
480  //read first parameter and check if we reached the end of the file
481  data_file >> N;
482  BaseParticle* P0;
485  if(get_k2max()) {
486  P0 = new DeltaMaxsParticle();
487  //std::cout << "in read_next_from_data_file(): using DeltaMaxsParticle" << std::endl;
488  } else if(get_mu()) {
489  P0 = new TangentialSpringParticle();
490  //std::cout << "in read_next_from_data_file(): using TangentialSpringParticle" << std::endl;
491  } else {
492  P0 = new BaseParticle();
493  //std::cout << "in read_next_from_data_file(): using BaseParticle" << std::endl;
494  }
495 
499  else
502  delete P0;
503 
504  #ifdef DEBUG_OUTPUT
505  std::cout << "Number of particles read from file "<<N << std::endl;
506  #endif
507 
508  if (data_file.eof()||data_file.peek()==-1) return false;
509  //read all other data available for the time step
510  switch(format)
511  {
512  //This is the format that Stefan's and Vitaley's code saves in - note the axis rotation
513  case 7:
514  {
515  data_file >> t >> xmin >> zmin >> ymin >> xmax >> zmax >> ymax;
516  //std::cout << " time " << t << std::endl;
517  Mdouble radius;
518  Vec3D position,velocity;
519  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it) {
520  data_file
521  >> position.X
522  >> position.Z
523  >> position.Y
524  >> velocity.X
525  >> velocity.Z
526  >> velocity.Y
527  >> radius
528  >> dummy;
529  (*it)->set_Position(position);
530  (*it)->set_Velocity(velocity);
531  (*it)->set_Angle(Vec3D(0.0,0.0,0.0));
532  (*it)->set_AngularVelocity(Vec3D(0.0,0.0,0.0));
533  (*it)->set_Radius(radius);
534  (*it)->compute_particle_mass(Species);
535  }
536  //End the interator over all particles
537  break;
538  }
539  //This is a 2D format
540  case 8:
541  {
542  data_file >> t >> xmin >> ymin >> xmax >> ymax;
543  zmin = 0.0;
544  zmax = 0.0;
545  Mdouble radius;
546  Vec3D position,velocity,angle,angularVelocity;
547  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it) {
548  data_file
549  >> position.X
550  >> position.Y
551  >> velocity.X
552  >> velocity.Y
553  >> radius
554  >> angle.Z
555  >> angularVelocity.Z
556  >> dummy;
557  (*it)->set_Position(position);
558  (*it)->set_Velocity(velocity);
559  (*it)->set_Angle(-angle);
560  (*it)->set_AngularVelocity(-angularVelocity);
561  (*it)->set_Radius(radius);
562  (*it)->compute_particle_mass(Species);
563  } //end for all particles
564  break;
565  }
566  //This is a 3D format
567  case 14:
568  {
569  data_file >> t >> xmin >> ymin >> zmin >> xmax >> ymax >> zmax;
570  Mdouble radius;
571  Vec3D position,velocity,angle,angularVelocity;
572  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it) {
573  data_file
574  >> position
575  >> velocity
576  >> radius
577  >> angle
578  >> angularVelocity
579  >> dummy;
580  (*it)->set_Position(position);
581  (*it)->set_Velocity(velocity);
582  (*it)->set_Angle(angle);
583  (*it)->set_AngularVelocity(angularVelocity);
584  (*it)->set_Radius(radius);
585  (*it)->compute_particle_mass(Species);
586  } //end for all particles
587  break;
588  }
589  //This is a 3D format
590  case 15:
591  {
592  data_file >> t >> xmin >> ymin >> zmin >> xmax >> ymax >> zmax;
593  Mdouble radius;
594  Vec3D position,velocity,angle,angularVelocity;
595  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it) {
596  data_file
597  >> position
598  >> velocity
599  >> radius
600  >> angle
601  >> angularVelocity
602  >> dummy >> dummy;
603  (*it)->set_Position(position);
604  (*it)->set_Velocity(velocity);
605  (*it)->set_Angle(angle);
606  (*it)->set_AngularVelocity(angularVelocity);
607  (*it)->set_Radius(radius);
608  (*it)->compute_particle_mass(Species);
609  } //end for all particles
610  break;
611  }
612  } //end switch statement
613 
614  //fix particles, if data_FixedParticles!=0
615  if (data_FixedParticles) {
616  //std::cout << "fix " << min(data_FixedParticles,getParticleHandler().getNumberOfObjects()) << " Particles" << std::endl;
617  for (int i=0; i<std::min(data_FixedParticles,(int) particleHandler.getNumberOfObjects()); i++)
619  }
620 
621  //clean up tangential springs
623 
624  return true;
625 }
Mdouble X
Definition: Vector.h:44
void copyAndAddObject(const T &O)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:93
void reset_TangentialSprings()
sets the history parameter TangentialSprings of all particles to zero
Definition: MD.h:644
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:220
int dim
The dimension of the simulation.
Definition: MD.h:660
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void removeLastObject()
Removes the last Object from the BaseHandler.
Definition: BaseHandler.h:147
std::fstream data_file
Stream used for data files.
Definition: STD_save.h:252
ParticleHandler particleHandler
Definition: MD.h:707
Mdouble xmax
Definition: MD.h:668
unsigned int get_options_data(void)
Definition: STD_save.h:162
Mdouble t
This stores the current time.
Definition: MD.h:687
Mdouble zmax
Definition: MD.h:668
double Mdouble
Definition: ExtendedMath.h:33
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:233
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
Mdouble Y
Definition: Vector.h:44
Mdouble get_mu(unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be accessed.
Definition: MD.h:247
bool increase_counter_data(std::fstream::openmode mode)
Definition: STD_save.h:221
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
Mdouble get_k2max(unsigned int indSpecies=0)
Definition: MD.h:194
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble Z
Definition: Vector.h:44
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
void fixParticle()
Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to ...
int data_FixedParticles
Definition: MD.h:702
void MD::read_v1 ( std::istream &  is)
virtual

Reads all MD data.

Definition at line 2217 of file MD.cc.

References boundaryHandler, BaseParticle::compute_particle_mass(), dt, BaseHandler< T >::getLastObject(), getLineFromStringStream(), gravity, max_radius, STD_save::options_data, STD_save::options_ene, STD_save::options_fstat, particleHandler, STD_save::problem_name, BoundaryHandler::readObject(), ParticleHandler::readObject(), WallHandler::readWall(), save_count_data, save_count_ene, save_count_fstat, save_count_stat, WallHandler::setStorageCapacity(), BaseHandler< T >::setStorageCapacity(), Species, t, tmax, wallHandler, xmax, xmin, ymax, ymin, zmax, and zmin.

Referenced by read().

2218 {
2219  std::cout << "reading restart data version 1" << std::endl;
2220  is >> gravity
2221  >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax
2222  >> dt >> t >> tmax
2227  std::string str;
2228  is >> str;
2229  problem_name.str(str);
2230  int N;
2231  unsigned int NParticles, NWalls, NBoundarys;
2232  is >> N; Species.resize(N);
2233  is >> NParticles; particleHandler.setStorageCapacity(NParticles);
2234  is >> NWalls; wallHandler.setStorageCapacity(NWalls);
2235  is >> NBoundarys; boundaryHandler.setStorageCapacity(NBoundarys);
2236  is >> options_fstat >> options_data >> options_ene;
2237  for (std::vector<CSpecies>::iterator it = Species.begin(); it!=Species.end(); ++it) is >> (*it);
2238 
2239  std::stringstream line (std::stringstream::in | std::stringstream::out);
2240  getLineFromStringStream(is,line);
2241 
2242  for (unsigned int i=0;i<NParticles;i++)
2243  {
2244  getLineFromStringStream(is,line);
2247  }
2248 
2249  for (unsigned int i=0;i<NWalls;i++)
2250  {
2251  getLineFromStringStream(is,line);
2252  wallHandler.readWall(line);
2253  }
2254 
2255  for (unsigned int i=0;i<NBoundarys;i++)
2256  {
2257  getLineFromStringStream(is,line);
2259  }
2260 }
void readWall(std::istream &is)
Reads BaseWall into the WallHandler from restart data.
Definition: WallHandler.cc:133
void compute_particle_mass(std::vector< CSpecies > &Species)
Compute Particle mass function, which required a reference to the Species vector. It copmuters the Pa...
void getLineFromStringStream(std::istream &in, std::stringstream &out)
void setStorageCapacity(const unsigned int N)
Sets the storage capacity of this WallHandler.
Definition: WallHandler.cc:236
void setStorageCapacity(const unsigned int N)
Sets the storage capacity of this BaseHandler.
Definition: BaseHandler.h:213
T * getLastObject() const
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:192
unsigned int options_fstat
Indicators if files are created or not 0: file will not be created 1: file will be written in one fil...
Definition: STD_save.h:262
void readObject(std::istream &is)
Reads BaseParticle into the ParticleHandler from restart data.
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
WallHandler wallHandler
Definition: MD.h:708
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
void readObject(std::istream &is)
Reads BaseBoundary into the BoundaryHandler from restart data.
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble xmax
Definition: MD.h:668
Mdouble max_radius
Definition: MD.h:665
Mdouble t
This stores the current time.
Definition: MD.h:687
int save_count_ene
Definition: MD.h:676
Mdouble zmax
Definition: MD.h:668
unsigned int options_ene
Definition: STD_save.h:265
int save_count_stat
Definition: MD.h:677
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
int save_count_fstat
Definition: MD.h:678
Mdouble tmax
Definition: MD.h:672
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
unsigned int options_data
Definition: STD_save.h:263
int save_count_data
These are informations for saving.
Definition: MD.h:675
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
void MD::read_v2 ( std::istream &  is)
virtual

Definition at line 2121 of file MD.cc.

References boundaryHandler, WallHandler::clear(), ParticleHandler::clear(), BaseHandler< T >::clear(), BaseParticle::compute_particle_mass(), data_FixedParticles, dim, dt, BaseHandler< T >::getLastObject(), getLineFromStringStream(), gravity, STD_save::options_data, STD_save::options_ene, STD_save::options_fstat, STD_save::options_restart, particleHandler, BoundaryHandler::readObject(), ParticleHandler::readObject(), WallHandler::readWall(), save_count_data, save_count_ene, save_count_fstat, save_count_stat, Species, t, tmax, wallHandler, xmax, xmin, ymax, ymin, zmax, and zmin.

Referenced by read().

2122 {
2123  std::string dummy;
2124  //std::cout << "version 2" << std::endl;
2125  is >> dummy >> xmin
2126  >> dummy >> xmax
2127  >> dummy >> ymin
2128  >> dummy >> ymax
2129  >> dummy >> zmin
2130  >> dummy >> zmax
2131  >> dummy >> dt
2132  >> dummy >> t
2133  >> dummy >> tmax
2134  >> dummy >> save_count_data
2135  >> dummy >> dim
2136  >> dummy >> gravity
2137  >> dummy >> options_fstat
2138  >> dummy >> options_data
2139  >> dummy >> options_ene
2140  >> dummy;
2144 
2145  //this is optional to allow restart files with and without options_restart
2146  if (!strcmp(dummy.c_str(),"options_restart")) is >> options_restart >> dummy;
2147 
2148  unsigned int N;
2149 
2150  is >> N;
2151  Species.resize(N);
2152  //please don't change this code to iterators; the mixed species requires indexing
2153  //old code: for (vector<CSpecies>::iterator it = Species.begin(); it!=Species.end(); ++it) it->read(is);
2154  for (unsigned int i=0; i<N; i++) {
2155  Species[i].read(is);
2156  Species[i].MixedSpecies.resize(i);
2157  for (unsigned int j=0; j<i; j++) {
2158  Species[i].MixedSpecies[j].read(is);
2159  }
2160  }
2161 
2162  std::stringstream line (std::stringstream::in | std::stringstream::out);
2163 
2164  is >> dummy >> N;
2165  wallHandler.clear();
2166  getLineFromStringStream(is,line);
2167  for (unsigned int i=0;i<N;i++)
2168  {
2169  getLineFromStringStream(is,line);
2170  wallHandler.readWall(line);
2171  }
2172 
2173  is >> dummy >> N;
2175  getLineFromStringStream(is,line);
2176  for (unsigned int i=0;i<N;i++)
2177  {
2178  getLineFromStringStream(is,line);
2179  boundaryHandler.readObject(line);
2180  }
2181 
2182  is >> dummy >> N;
2184  getLineFromStringStream(is,line);
2185  for (unsigned int i=0;i<N;i++)
2186  {
2187  getLineFromStringStream(is,line);
2190  }
2191 
2192  //After the lines storing particle data, an optional variable 'FixedParticles' can be read in, which fixes the first 'FixedParticles' particles
2193  if (is.peek()==70) is >> dummy >> data_FixedParticles;
2194 }
unsigned int options_restart
Definition: STD_save.h:266
void readWall(std::istream &is)
Reads BaseWall into the WallHandler from restart data.
Definition: WallHandler.cc:133
void compute_particle_mass(std::vector< CSpecies > &Species)
Compute Particle mass function, which required a reference to the Species vector. It copmuters the Pa...
void getLineFromStringStream(std::istream &in, std::stringstream &out)
T * getLastObject() const
Gets a pointer to the last Object in this BaseHandler.
Definition: BaseHandler.h:192
unsigned int options_fstat
Indicators if files are created or not 0: file will not be created 1: file will be written in one fil...
Definition: STD_save.h:262
int dim
The dimension of the simulation.
Definition: MD.h:660
void readObject(std::istream &is)
Reads BaseParticle into the ParticleHandler from restart data.
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
WallHandler wallHandler
Definition: MD.h:708
void clear()
Empties the whole ParticleHandler by removing all BaseParticle.
void readObject(std::istream &is)
Reads BaseBoundary into the BoundaryHandler from restart data.
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble xmax
Definition: MD.h:668
Mdouble t
This stores the current time.
Definition: MD.h:687
int save_count_ene
Definition: MD.h:676
Mdouble zmax
Definition: MD.h:668
unsigned int options_ene
Definition: STD_save.h:265
int save_count_stat
Definition: MD.h:677
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
int save_count_fstat
Definition: MD.h:678
Mdouble tmax
Definition: MD.h:672
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
unsigned int options_data
Definition: STD_save.h:263
int save_count_data
These are informations for saving.
Definition: MD.h:675
Mdouble ymin
Definition: MD.h:668
void clear()
Empties the whole WallHandler by removing all BaseWall.
Definition: WallHandler.cc:127
void clear()
Empties the whole BaseHandler by removing all Object.
Definition: BaseHandler.h:162
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
int data_FixedParticles
Definition: MD.h:702
int MD::readArguments ( unsigned int  argc,
char *  argv[] 
)

Can interpret main function input arguments that are passed by the driver codes.

Definition at line 2535 of file MD.cc.

References readNextArgument().

Referenced by solve().

2536 {
2537  bool isRead = true;
2538  for (unsigned int i = 1; i<argc; i+=2) {
2539  std::cout << "interpreting input argument " << argv[i];
2540  for (unsigned int j = i+1; j<argc; j++) {
2541  if (argv[j][0]=='-') break;
2542  std::cout << " " << argv[j];
2543  }
2544  std::cout << std::endl;
2545  isRead &= readNextArgument(i, argc, argv);
2546  if (!isRead) {
2547  std::cerr << "Warning: not all arguments read correctly!" << std::endl;
2548  exit(-10);
2549  }
2550  }
2551  return isRead;
2552 }
virtual int readNextArgument(unsigned int &i, unsigned int argc, char *argv[])
Definition: MD.cc:2554
int MD::readNextArgument ( unsigned int i,
unsigned int  argc,
char *  argv[] 
)
virtual

argv[i+1] interpreted as argument of type char*, Mdouble, integer or boolean unless noted

-gravity requires three arguments

-restart or -r loads a restart file. By default, it loads <get_name()>.restart. If an argument "arg" is given it loads the file "arg", or "arg".restart (if the ending is not given).

Reimplemented in ChuteWithHopper, ChuteWithHopperAndInset, Chute, and HGRID_base.

Definition at line 2554 of file MD.cc.

References STD_save::auto_number(), get_disp(), get_disprolling(), get_dispt(), get_dt(), get_k(), get_krolling(), get_kt(), get_mu(), get_murolling(), STD_save::get_name(), get_tmax(), Hertzian, load_from_data_file(), load_restart_data(), random, RNG::randomise(), set_append(), STD_save::set_counter(), set_dim(), set_dim_particle(), set_disp(), set_disprolling(), set_dispt(), set_dt(), set_FixedParticles(), set_gravity(), set_k(), set_krolling(), set_kt(), set_mu(), set_murolling(), set_name(), set_number_of_saves_all(), STD_save::set_options_data(), STD_save::set_options_ene(), STD_save::set_options_fstat(), STD_save::set_options_restart(), STD_save::set_options_stat(), set_rho(), set_save_count_data(), set_save_count_ene(), set_save_count_fstat(), set_save_count_stat(), set_savecount(), set_tmax(), set_xmax(), set_xmin(), set_ymax(), set_ymin(), set_zmax(), set_zmin(), and Species.

Referenced by readArguments(), and HGRID_base::readNextArgument().

2555 {
2557  if (!strcmp(argv[i],"-name")) {
2558  set_name(argv[i+1]);
2559  } else if (!strcmp(argv[i],"-xmin")) {
2560  set_xmin(atof(argv[i+1]));
2561  } else if (!strcmp(argv[i],"-ymin")) {
2562  set_ymin(atof(argv[i+1]));
2563  } else if (!strcmp(argv[i],"-zmin")) {
2564  set_zmin(atof(argv[i+1]));
2565  } else if (!strcmp(argv[i],"-xmax")) {
2566  set_xmax(atof(argv[i+1]));
2567  } else if (!strcmp(argv[i],"-ymax")) {
2568  set_ymax(atof(argv[i+1]));
2569  } else if (!strcmp(argv[i],"-zmax")) {
2570  set_zmax(atof(argv[i+1]));
2571  //} else if (!strcmp(argv[i],"-svn")) {
2572  // std::cout << "svn version " << SVN_VERSION << std::endl;
2573  // i--;
2574  } else if (!strcmp(argv[i],"-dt")) {
2575  Mdouble old=get_dt();
2576  set_dt(atof(argv[i+1]));
2577  std::cout << " reset dt from " << old << " to " << get_dt() << std::endl;
2578  } else if (!strcmp(argv[i],"-Hertzian")) {
2579  Species[0].set_ForceType(Hertzian);
2580  i--;
2581  } else if (!strcmp(argv[i],"-tmax")) {
2582  Mdouble old = get_tmax();
2583  set_tmax(atof(argv[i+1]));
2584  std::cout << " reset tmax from " << old << " to " << get_tmax() << std::endl;
2585  } else if (!strcmp(argv[i],"-save_count") || !strcmp(argv[i],"-savecount")) {
2586  set_savecount(atoi(argv[i+1]));
2587  } else if (!strcmp(argv[i],"-save_count_data")) {
2588  set_save_count_data(atoi(argv[i+1]));
2589  } else if (!strcmp(argv[i],"-save_count_fstat")) {
2590  set_save_count_fstat(atoi(argv[i+1]));
2591  } else if (!strcmp(argv[i],"-save_count_stat")) {
2592  set_save_count_stat(atoi(argv[i+1]));
2593  } else if (!strcmp(argv[i],"-save_count_ene")) {
2594  set_save_count_ene(atoi(argv[i+1]));
2595  } else if (!strcmp(argv[i],"-dim")) {
2596  set_dim(atoi(argv[i+1]));
2597  } else if (!strcmp(argv[i],"-gravity")) {
2599  set_gravity(Vec3D(atof(argv[i+1]),atof(argv[i+2]),atof(argv[i+3])));
2600  i+=2;
2601  } else if (!strcmp(argv[i],"-options_fstat")) {
2602  set_options_fstat(atoi(argv[i+1]));
2603  } else if (!strcmp(argv[i],"-options_restart")) {
2604  set_options_restart(atoi(argv[i+1]));
2605  } else if (!strcmp(argv[i],"-options_data")) {
2606  set_options_data(atoi(argv[i+1]));
2607  } else if (!strcmp(argv[i],"-options_stat")) {
2608  set_options_stat(atoi(argv[i+1]));
2609  } else if (!strcmp(argv[i],"-options_ene")) {
2610  set_options_ene(atoi(argv[i+1]));
2611  } else if (!strcmp(argv[i],"-auto_number")) {
2612  auto_number();
2613  i--;
2614  } else if (!strcmp(argv[i],"-number_of_saves")) {
2615  set_number_of_saves_all(atof(argv[i+1]));
2616  } else if (!strcmp(argv[i],"-restart")||!strcmp(argv[i],"-r")) {
2620  std::string filename;
2621 
2622  //use default filename if no argument is given
2623  if (i+1>=argc||argv[i+1][0]=='-') {
2624  i--;
2625  filename = get_name();
2626  std::cout << get_name() << std::endl;
2627  } else filename = argv[i+1];
2628 
2629  //add ".restart" if necessary
2630  const char* fileextension = (filename.c_str()+std::max(0,(int)filename.length()-8));
2631  if (strcmp(fileextension,".restart"))
2632  filename=filename+".restart";
2633 
2634  std::cout << "restart from " << filename << std::endl;
2635  load_restart_data(filename);
2636  } else if (!strcmp(argv[i],"-data")) {
2637  std::string filename = argv[i+1];
2638  load_from_data_file(filename.c_str());
2639  } else if (!strcmp(argv[i],"-k")) {
2640  Mdouble old = get_k();
2641  set_k(atof(argv[i+1]));
2642  std::cout << " reset k from " << old << " to " << get_k() << std::endl;
2643  } else if (!strcmp(argv[i],"-disp")) {
2644  Mdouble old = get_disp();
2645  set_disp(atof(argv[i+1]));
2646  std::cout << " reset disp from " << old << " to " << get_disp() << std::endl;
2647  } else if (!strcmp(argv[i],"-kt")) {
2648  Mdouble old = get_kt();
2649  set_kt(atof(argv[i+1]));
2650  std::cout << " reset kt from " << old << " to " << get_kt() << std::endl;
2651  } else if (!strcmp(argv[i],"-dispt")) {
2652  Mdouble old = get_dispt();
2653  set_dispt(atof(argv[i+1]));
2654  std::cout << " reset dispt from " << old << " to " << get_dispt() << std::endl;
2655  } else if (!strcmp(argv[i],"-krolling")) {
2656  Mdouble old = get_krolling();
2657  set_krolling(atof(argv[i+1]));
2658  std::cout << " reset krolling from " << old << " to " << get_krolling() << std::endl;
2659  } else if (!strcmp(argv[i],"-disprolling")) {
2660  Mdouble old = get_disprolling();
2661  set_disprolling(atof(argv[i+1]));
2662  std::cout << " reset disprolling from " << old << " to " << get_disprolling() << std::endl;
2663  } else if (!strcmp(argv[i],"-mu")) {
2664  Mdouble old = get_mu();
2665  set_mu(atof(argv[i+1]));
2666  std::cout << " reset mu from " << old << " to " << get_mu() << std::endl;
2667  } else if (!strcmp(argv[i],"-murolling")) {
2668  Mdouble old = get_mu();
2669  set_murolling(atof(argv[i+1]));
2670  std::cout << " reset murolling from " << old << " to " << get_murolling() << std::endl;
2671  } else if (!strcmp(argv[i],"-randomise") || !strcmp(argv[i],"-randomize")) {
2672  random.randomise();
2673  i--;
2674  } else if (!strcmp(argv[i],"-k0")) {
2675  Mdouble old = Species[0].get_k0();
2676  Species[0].set_k0(atof(argv[i+1]));
2677  std::cout << " reset k0 from " << old << " to " << Species[0].get_k0() << std::endl;
2678  } else if (!strcmp(argv[i],"-f0")) {
2679  Mdouble old = Species[0].get_f0();
2680  Species[0].set_f0(atof(argv[i+1]));
2681  std::cout << " reset f0 from " << old << " to " << Species[0].get_f0() << std::endl;
2682  } else if (!strcmp(argv[i],"-AdhesionForceType")) {
2683  Mdouble old = Species[0].get_AdhesionForceType();
2684  Species[0].set_AdhesionForceType(argv[i+1]);
2685  std::cout << " reset AdhesionForceType from " << old << " to " << Species[0].get_AdhesionForceType() << std::endl;
2686  } else if (!strcmp(argv[i],"-append")) {
2687  set_append(true);
2688  i--;
2689  } else if (!strcmp(argv[i],"-fixedParticles")) {
2690  set_FixedParticles(atof(argv[i+1]));
2691  } else if (!strcmp(argv[i],"-rho")) {
2692  set_rho(atof(argv[i+1]));
2693  } else if (!strcmp(argv[i],"-dim_particle")) {
2694  set_dim_particle(atoi(argv[i+1]));
2695  } else if (!strcmp(argv[i],"-counter")) {
2696  set_counter(atoi(argv[i+1]));
2697  } else return false;
2698  return true; //returns true if argv is found
2699 }
void set_save_count_stat(int new_)
Definition: MD.h:159
void set_krolling(Mdouble new_, unsigned int indSpecies=0)
Allows the spring constant to be changed.
Definition: MD.h:212
void set_zmax(Mdouble new_zmax)
Sets ymax and walls, assuming the standard definition of walls as in the default constructor.
Definition: MD.h:334
void set_counter(int new_counter)
This set the counter, overriding the defaults.
Definition: STD_save.cc:78
Mdouble get_disprolling(unsigned int indSpecies=0)
Allows the tangential viscosity to be accessed.
Definition: MD.h:230
Mdouble get_dispt(unsigned int indSpecies=0)
Allows the tangential viscosity to be accessed.
Definition: MD.h:226
void set_append(bool new_)
Sets restarted.
Definition: MD.h:391
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
void set_zmin(Mdouble new_zmin)
Sets ymin and walls, assuming the standard definition of walls as in the default constructor.
Definition: MD.h:324
void set_options_data(unsigned int new_)
Definition: STD_save.h:161
void set_dt()
Sets dt to 1/50-th of the smallest possible collision time.
Definition: MD.h:447
void set_options_restart(unsigned int new_)
Definition: STD_save.h:167
void set_savecount(int new_)
Allows the number of time steps between saves to be changed, see also set_number_of_saves.
Definition: MD.h:155
bool load_from_data_file(const char *filename, unsigned int format=0)
This allows particle data to be reloaded from data files.
Definition: MD.cc:250
void set_xmin(Mdouble new_xmin)
Sets xmin and walls, assuming the standard definition of walls as in the default constructor.
Definition: MD.h:318
void set_tmax(Mdouble new_tmax)
Allows the upper time limit to be changed.
Definition: MD.h:142
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble get_krolling(int indSpecies=0)
Allows the spring constant to be accessed.
Definition: MD.h:214
Mdouble get_murolling(unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be accessed.
Definition: MD.h:251
void set_murolling(Mdouble new_, unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be changed.
Definition: MD.h:249
void randomise()
sets the random variables such that they differ for each run
Definition: RNG.h:59
RNG random
Definition: MD.h:515
void set_options_fstat(unsigned int new_)
set and get for file options
Definition: STD_save.h:158
void set_save_count_fstat(int new_)
Definition: MD.h:160
void set_kt(Mdouble new_, unsigned int indSpecies=0)
Allows the spring constant to be changed.
Definition: MD.h:208
double Mdouble
Definition: ExtendedMath.h:33
void set_save_count_data(int new_)
Definition: MD.h:157
void set_dim_particle(int new_, unsigned int indSpecies=0)
Allows the dimension of the particle (f.e. for mass) to be changed.
Definition: MD.h:261
Mdouble get_k(int indSpecies=0)
Allows the spring constant to be accessed.
Definition: MD.h:206
Mdouble get_kt(int indSpecies=0)
Allows the spring constant to be accessed.
Definition: MD.h:210
void set_FixedParticles(unsigned int n)
Definition: MD.h:613
void set_ymax(Mdouble new_ymax)
Sets ymax and walls, assuming the standard definition of walls as in the default constructor.
Definition: MD.h:331
Mdouble get_tmax()
Allows the upper time limit to be accessed.
Definition: MD.h:144
void set_mu(Mdouble new_, unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be changed.
Definition: MD.h:245
Mdouble get_disp(unsigned int indSpecies=0)
Allows the normal dissipation to be accessed.
Definition: MD.h:239
void set_rho(Mdouble new_, unsigned int indSpecies=0)
Allows the density to be changed.
Definition: MD.h:220
Mdouble get_mu(unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be accessed.
Definition: MD.h:247
void set_name(const char *name)
Sets the name of the problem, used for the same data files.
Definition: MD.h:342
int load_restart_data()
Loads all MD data.
Definition: MD.cc:685
void set_number_of_saves_all(Mdouble N)
Definition: MD.h:172
void set_dim(int new_dim)
Allows the dimension of the simulation to be changed.
Definition: MD.h:367
std::string get_name()
Allows the problem_name to be accessed.
Definition: STD_save.h:127
void set_gravity(Vec3D new_gravity)
Allows the gravitational acceleration to be changed.
Definition: MD.h:362
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
void set_disprolling(Mdouble new_, unsigned int indSpecies=0)
Allows the tangential viscosity to be changed.
Definition: MD.h:228
void auto_number()
Definition: STD_save.h:116
void set_ymin(Mdouble new_ymin)
Definition: MD.h:320
void set_options_stat(unsigned int new_)
Definition: STD_save.h:164
void set_dispt(Mdouble new_, unsigned int indSpecies=0)
Allows the tangential viscosity to be changed.
Definition: MD.h:224
void set_k(Mdouble new_, unsigned int indSpecies=0)
Allows the spring constant to be changed.
Definition: MD.h:204
void set_save_count_ene(int new_)
Definition: MD.h:158
void set_disp(Mdouble new_, unsigned int indSpecies=0)
Allows the normal dissipation to be changed.
Definition: MD.h:237
void set_options_ene(unsigned int new_)
Definition: STD_save.h:170
void set_xmax(Mdouble new_xmax)
Sets xmax and walls, assuming the standard definition of walls as in the default constructor.
Definition: MD.h:328
void MD::Remove_Duplicate_Periodic_Particles ( )
private

Remove periodic duplicate Particles (i.e. removes particles created by Check_and_Duplicate_Periodic_Particle(int i, int nWallPeriodic)). Note that between these two functions it is not allowed to create additional functions.

Remove periodic duplicate Particles (i.e. removes particles created by Check_and_Duplicate_Periodic_Particle(int i, int nWallPeriodic)). Note that between these two functions it is not allowed to create additional functions. It returns the number of Particles removed.

Definition at line 2703 of file MD.cc.

References BaseParticle::get_PeriodicFromParticle(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), particleHandler, PeriodicCreated, R, and removeParticle().

Referenced by solve(), and statistics_from_restart_data().

2704  {
2705  int R=0;
2707  {
2708  removeParticle(i);
2709  R++;
2710  }
2711  if(R!=PeriodicCreated)
2712  {
2713  std::cerr<<"ERROR :: Periodic Particles Removed not equal to Periodic Particles Created, it created "<<PeriodicCreated<<" Particles, but removed "<<R<<std::endl<<std::endl;
2714  exit(-1);
2715  }
2716  }
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
BaseParticle * get_PeriodicFromParticle() const
ParticleHandler particleHandler
Definition: MD.h:707
int PeriodicCreated
Definition: MD.h:722
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
virtual void removeParticle(int iP)
Definition: MD.h:420
void MD::Remove_Particle ( int  IP)

This function removes partice IP from the vector of particles by moving the last particle in the vector to the position if IP Also it checks if the moved Particle has any tangentialsspring-information, which needs to be moved to a different particle, because tangential spring information always needs to be stored in the real particle with highest particle index.

virtual void MD::removeParticle ( int  iP)
inlinevirtual

Definition at line 420 of file MD.h.

References BaseHandler< T >::getObject(), HGRID_RemoveParticleFromHgrid(), particleHandler, and BaseHandler< T >::removeObject().

Referenced by Chute::clean_chute(), and Remove_Duplicate_Periodic_Particles().

421  {
422 #ifdef ContactListHgrid
423  possibleContactList.remove_ParticlePosibleContacts(particleHandler.getObject(iP));
424 #endif
427  }
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
virtual void HGRID_RemoveParticleFromHgrid(BaseParticle *obj UNUSED)
Definition: MD.h:560
ParticleHandler particleHandler
Definition: MD.h:707
virtual void removeObject(unsigned const int id)
Removes a Object from the BaseHandler.
Definition: BaseHandler.h:122
void MD::reset_DeltaMax ( )
inlineprotected

sets the history parameter DeltaMax of all particles to zero

Definition at line 633 of file MD.h.

References BaseHandler< T >::begin(), BaseHandler< T >::end(), DeltaMaxsParticle::get_DeltaMaxs(), and particleHandler.

634  {
635  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it)
636  {
637  DeltaMaxsParticle* DMParticle=dynamic_cast<DeltaMaxsParticle*>(*it);
638  if(DMParticle)
639  DMParticle->get_DeltaMaxs().resize(0);
640  }
641  }
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:220
CDeltaMaxs & get_DeltaMaxs()
ParticleHandler particleHandler
Definition: MD.h:707
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:233
void MD::reset_TangentialSprings ( )
inlineprotected

sets the history parameter TangentialSprings of all particles to zero

Definition at line 644 of file MD.h.

References BaseHandler< T >::begin(), BaseHandler< T >::end(), TangentialSpringParticle::get_TangentialSprings(), and particleHandler.

Referenced by read_next_from_data_file().

645  {
646  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it)
647  {
648  TangentialSpringParticle* TSParticle=dynamic_cast<TangentialSpringParticle*>(*it);
649  if(TSParticle)
650  TSParticle->get_TangentialSprings().resize(0);
651  }
652  }
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:220
CTangentialSprings & get_TangentialSprings()
ParticleHandler particleHandler
Definition: MD.h:707
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:233
void MD::save_restart_data ( )
virtual

Stores all MD data.

This function stores all MD data - See also MD::load_restart_data.

todo{This can probably done a lot nicer}

Definition at line 654 of file MD.cc.

References STD_save::options_restart, STD_save::problem_name, save_restart_data_counter, and write().

Referenced by solve(), and StatisticsVector< T >::statistics_from_p3().

654  {
655  std::stringstream restart_filename;
656  restart_filename.str("");
657  restart_filename << problem_name.str().c_str() << ".restart";
658 
660  if (options_restart==2) {
661  restart_filename << ".";
662  if (save_restart_data_counter<1000) restart_filename << "0";
663  if (save_restart_data_counter<100) restart_filename << "0";
664  if (save_restart_data_counter<10) restart_filename << "0";
665  restart_filename << save_restart_data_counter;
666  save_restart_data_counter++;
667  }
668 
669  std::ofstream restart_data(restart_filename.str().c_str());
670  restart_data.precision(8); //max. 16 for Mdouble precision
671  if( restart_data.good() )
672  {
673  write(restart_data);
674  restart_data.close();
675  } else {
676  std::cerr << "restart_data " << restart_filename.str() << " could not be saved" << std::endl;
677  exit(-1);
678  }
679 }
unsigned int options_restart
Definition: STD_save.h:266
int save_restart_data_counter
Definition: MD.h:723
virtual void write(std::ostream &os)
Writes all MD data.
Definition: MD.cc:1985
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
void MD::set_append ( bool  new_)
inline

Sets restarted.

Definition at line 391 of file MD.h.

References append.

Referenced by constructor(), readNextArgument(), and set_restarted().

391 {append=new_;}
bool append
Definition: MD.h:720
void MD::set_collision_time_and_normal_and_tangential_restitution_coefficient ( Mdouble  tc,
Mdouble  eps,
Mdouble  beta,
Mdouble  mass1,
Mdouble  mass2,
unsigned int  indSpecies = 0 
)
inline

See CSpecies::set_collision_time_and_normal_and_tangential_restitution_coefficient.

Definition at line 289 of file MD.h.

References Species.

289  {
290  if (indSpecies<Species.size()) {Species[indSpecies].set_collision_time_and_normal_and_tangential_restitution_coefficient(tc, eps, beta, mass1, mass2);} else {std::cerr << "Error in set_collision_time_and_restitution_coefficient: species does not exist"; exit(-1);}
291  }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt ( Mdouble  tc,
Mdouble  eps,
Mdouble  beta,
Mdouble  mass1,
Mdouble  mass2,
unsigned int  indSpecies = 0 
)
inline

See CSpecies::set_collision_time_and_normal_and_tangential_restitution_coefficient.

Definition at line 294 of file MD.h.

References Species.

294  {
295  if (indSpecies<Species.size()) {Species[indSpecies].set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt(tc, eps, beta, mass1, mass2);} else {std::cerr << "Error in set_collision_time_and_restitution_coefficient: species does not exist"; exit(-1);}
296 
297  }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_collision_time_and_restitution_coefficient ( Mdouble  tc,
Mdouble  eps,
Mdouble  mass,
unsigned int  indSpecies = 0 
)
inline

Sets k, disp such that it matches a given tc and eps for a collision of two copies of P.

Definition at line 276 of file MD.h.

References Species.

276  {
277  if (indSpecies<Species.size()) {Species[indSpecies].set_collision_time_and_restitution_coefficient(tc, eps, mass);} else {std::cerr << "Error in set_collision_time_and_restitution_coefficient: species does not exist"; exit(-1);}
278  }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_collision_time_and_restitution_coefficient ( Mdouble  tc,
Mdouble  eps,
Mdouble  mass1,
Mdouble  mass2,
unsigned int  indSpecies = 0 
)
inline

Set k, disp such that is matches a given tc and eps for a collision of two different masses.

Recall the resitution constant is a function of k, disp and the mass of each particle in the collision See also set_collision_time_and_restitution_coefficient(Mdouble tc, Mdouble eps, Mdouble mass)

Definition at line 283 of file MD.h.

References Species.

284  {
285  if (indSpecies<Species.size()) {Species[indSpecies].set_collision_time_and_restitution_coefficient(tc, eps, mass1, mass2);} else {std::cerr << "Error in set_collision_time_and_restitution_coefficient: species does not exist"; exit(-1);}
286  }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_depth ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Definition at line 189 of file MD.h.

References Species.

190  {if (indSpecies<Species.size()) {Species[indSpecies].set_depth(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_dim ( int  new_dim)
inline

Allows the dimension of the simulation to be changed.

Definition at line 367 of file MD.h.

References dim.

Referenced by HGRID_3D::constructor(), readNextArgument(), and StatisticsVector< T >::statistics_from_p3().

367 { if (new_dim>=1 && new_dim<=3) dim = new_dim; else { std::cerr << "Error in set_dim" << std::endl; exit(-1); }}
int dim
The dimension of the simulation.
Definition: MD.h:660
void MD::set_dim_particle ( int  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the dimension of the particle (f.e. for mass) to be changed.

Definition at line 261 of file MD.h.

References Species.

Referenced by HGRID_3D::constructor(), constructor(), load_par_ini_file(), and readNextArgument().

261 {if (indSpecies<Species.size()) {Species[indSpecies].set_dim_particle(new_);} else {std::cerr << "Error in set_dim_particle: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_disp ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the normal dissipation to be changed.

Definition at line 237 of file MD.h.

References Species.

Referenced by load_par_ini_file(), and readNextArgument().

237 {if (indSpecies<Species.size()) {Species[indSpecies].set_dissipation(new_);} else {std::cerr << "Error in set_dissipation: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_disprolling ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the tangential viscosity to be changed.

Definition at line 228 of file MD.h.

References Species.

Referenced by readNextArgument().

228 {if (indSpecies<Species.size()) {Species[indSpecies].set_disprolling(new_);} else {std::cerr << "Error in set_disprolling: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_dispt ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the tangential viscosity to be changed.

Definition at line 224 of file MD.h.

References Species.

Referenced by readNextArgument().

224 {if (indSpecies<Species.size()) {Species[indSpecies].set_dispt(new_);} else {std::cerr << "Error in set_dispt: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_disptorsion ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the tangential viscosity to be changed.

Definition at line 232 of file MD.h.

References Species.

232 {if (indSpecies<Species.size()) {Species[indSpecies].set_disptorsion(new_);} else {std::cerr << "Error in set_disptorsion: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_dissipation ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the normal dissipation to be changed.

Definition at line 241 of file MD.h.

References Species.

Referenced by Chute::set_collision_time_and_restitution_coefficient().

241 {if (indSpecies<Species.size()) {Species[indSpecies].set_dissipation(new_);} else {std::cerr << "Error in set_dissipation: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_do_stat_always ( bool  new_)
inline

Sets how often the data is saved using the number of saves wanted, tmax, and dt. See also set_savecount.

Definition at line 170 of file MD.h.

References do_stat_always.

Referenced by constructor().

170 {do_stat_always=new_;}
bool do_stat_always
Definition: MD.h:683
void MD::set_dt ( Mdouble  new_dt)
inline

Allows the time step dt to be changed.

Definition at line 337 of file MD.h.

References dt.

337 {if (dt>=0.0){dt=new_dt;} else { std::cerr << "Error in set_dt" << std::endl; exit(-1); }}
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
void MD::set_dt ( BaseParticle P)
inline

Sets dt to 1/50-th of the collision time for two copies of P.

Definition at line 440 of file MD.h.

References dt, get_collision_time(), BaseParticle::get_IndSpecies(), BaseParticle::get_Mass(), and Species.

440  {
441  Mdouble mass = P.get_Mass();
442  dt = .02 * get_collision_time(mass);
443  if (Species[P.get_IndSpecies()].dispt) { dt = std::min(dt,0.125*mass/Species[P.get_IndSpecies()].dispt); std::cerr << "Warning: dispt is large, dt had to be lowered"; }
444  }
int get_IndSpecies() const
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble get_Mass() const
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
double Mdouble
Definition: ExtendedMath.h:33
Mdouble get_collision_time(Mdouble mass, unsigned int indSpecies=0)
Calculates collision time for two copies of a particle of given disp, k, mass.
Definition: MD.h:300
void MD::set_dt ( )
inline

Sets dt to 1/50-th of the smallest possible collision time.

Todo:
should setup_... be used here or not (by Thomas)
Todo:
{Is it necesarry to reset initial conditions here and in solve? (i.e. should it be in constructor)?}

Definition at line 447 of file MD.h.

References BaseParticle::compute_particle_mass(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), getSmallestParticle(), particleHandler, setup_particles_initial_conditions(), and Species.

Referenced by actions_before_time_loop(), load_par_ini_file(), readNextArgument(), and Chute::set_dt().

447  {
453  }
virtual void setup_particles_initial_conditions()
This function allows the initial conditions of the particles to be set, by default locations is rando...
Definition: MD.cc:120
void compute_particle_mass(std::vector< CSpecies > &Species)
Compute Particle mass function, which required a reference to the Species vector. It copmuters the Pa...
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
void set_dt()
Sets dt to 1/50-th of the smallest possible collision time.
Definition: MD.h:447
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
ParticleHandler particleHandler
Definition: MD.h:707
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
virtual BaseParticle * getSmallestParticle()
Definition: MD.h:418
void MD::set_dt_by_mass ( Mdouble  mass)
inline

Sets dt to 1/50-th of the collision time for two particles of mass P.

Definition at line 437 of file MD.h.

References dt, and get_collision_time().

437 {dt = .02 * get_collision_time(mass);}
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble get_collision_time(Mdouble mass, unsigned int indSpecies=0)
Calculates collision time for two copies of a particle of given disp, k, mass.
Definition: MD.h:300
void MD::set_ene_ela ( Mdouble  new_)
inline

Sets ene_ela.

Definition at line 397 of file MD.h.

References ene_ela.

Referenced by output_ene().

397 {ene_ela=new_;}
Mdouble ene_ela
used in force calculations
Definition: MD.h:690
void MD::set_FixedParticles ( unsigned int  n)
inlineprotected

Definition at line 613 of file MD.h.

References BaseParticle::fixParticle(), BaseHandler< T >::getNumberOfObjects(), BaseHandler< T >::getObject(), and particleHandler.

Referenced by readNextArgument().

613 {for (unsigned int i=0; i<std::min((unsigned int)particleHandler.getNumberOfObjects(),n); i++) particleHandler.getObject(i)->fixParticle();}
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
ParticleHandler particleHandler
Definition: MD.h:707
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
void fixParticle()
Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to ...
void MD::set_format ( int  new_)
inline

Definition at line 507 of file MD.h.

References format.

Referenced by StatisticsVector< T >::statistics_from_p3().

507 {format = new_;}
int format
Definition: MD.h:699
void MD::set_gravity ( Vec3D  new_gravity)
inline

Allows the gravitational acceleration to be changed.

Definition at line 362 of file MD.h.

References gravity.

Referenced by load_par_ini_file(), readNextArgument(), and Chute::set_ChuteAngle().

362 {gravity = new_gravity;}
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
virtual void MD::set_initial_pressures_for_pressure_controlled_walls ( )
inlineprotectedvirtual

Definition at line 587 of file MD.h.

Referenced by solve().

587 {};
void MD::set_k ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the spring constant to be changed.

Definition at line 204 of file MD.h.

References Species.

Referenced by constructor(), load_par_ini_file(), readNextArgument(), and Chute::set_collision_time_and_restitution_coefficient().

204 {if (indSpecies<Species.size()) {Species[indSpecies].set_k(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_k1 ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Definition at line 183 of file MD.h.

References Species.

184  {if (indSpecies<Species.size()) {Species[indSpecies].set_k1(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_k2max ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Definition at line 185 of file MD.h.

References Species.

186  {if (indSpecies<Species.size()) {Species[indSpecies].set_k2max(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_k_and_restitution_coefficient ( Mdouble  k_,
Mdouble  eps,
Mdouble  mass,
unsigned int  indSpecies = 0 
)
inline

Sets k, disp such that it matches a given tc and eps for a collision of two copies of P.

Definition at line 272 of file MD.h.

References Species.

272  {
273  if (indSpecies<Species.size()) {Species[indSpecies].set_k_and_restitution_coefficient(k_, eps, mass);} else {std::cerr << "Error in set_k_and_restitution_coefficient: species does not exist"; exit(-1);}
274  }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_kc ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Definition at line 187 of file MD.h.

References Species.

188  {if (indSpecies<Species.size()) {Species[indSpecies].set_kc(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_krolling ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the spring constant to be changed.

Definition at line 212 of file MD.h.

References Species.

Referenced by readNextArgument().

212 {if (indSpecies<Species.size()) {Species[indSpecies].set_krolling(new_);} else {std::cerr << "Error in set_krolling: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_kt ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the spring constant to be changed.

Definition at line 208 of file MD.h.

References Species.

Referenced by readNextArgument().

208 {if (indSpecies<Species.size()) {Species[indSpecies].set_kt(new_);} else {std::cerr << "Error in set_kt: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_ktorsion ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the spring constant to be changed.

Definition at line 216 of file MD.h.

References Species.

216 {if (indSpecies<Species.size()) {Species[indSpecies].set_ktorsion(new_);} else {std::cerr << "Error in set_ktorsion: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_MixedSpecies ( int  i,
int  j,
CSpecies S 
)
inline

Allows the mixed species to be set.

Definition at line 136 of file MD.h.

References Species.

136  {
137  if (i>j) Species[i].MixedSpecies[j] = S;
138  else Species[j].MixedSpecies[i] = S;
139  };
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_mu ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the Coulomb friction coefficient to be changed.

Definition at line 245 of file MD.h.

References Species.

Referenced by ChuteBottom::make_rough_bottom(), and readNextArgument().

245 {if (indSpecies<Species.size()) {Species[indSpecies].set_mu(new_);} else {std::cerr << "Error in set_mu: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_murolling ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the Coulomb friction coefficient to be changed.

Definition at line 249 of file MD.h.

References Species.

Referenced by readNextArgument().

249 {if (indSpecies<Species.size()) {Species[indSpecies].set_murolling(new_);} else {std::cerr << "Error in set_murolling: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_mutorsion ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the Coulomb friction coefficient to be changed.

Definition at line 253 of file MD.h.

References Species.

253 {if (indSpecies<Species.size()) {Species[indSpecies].set_mutorsion(new_);} else {std::cerr << "Error in set_mutorsion: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_name ( const char *  name)
inline

Sets the name of the problem, used for the same data files.

Definition at line 342 of file MD.h.

References STD_save::problem_name.

Referenced by ChuteBottom::constructor(), and readNextArgument().

342 {problem_name.str(""); problem_name << name;}
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
void MD::set_number_of_saves ( Mdouble  N)
inline

Definition at line 171 of file MD.h.

References set_number_of_saves_all().

void set_number_of_saves_all(Mdouble N)
Definition: MD.h:172
void MD::set_number_of_saves_all ( Mdouble  N)
inline

Definition at line 172 of file MD.h.

References dt, set_save_count_all(), and tmax.

Referenced by readNextArgument(), and set_number_of_saves().

172 {if (dt) {set_save_count_all((N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000);} else {std::cerr << "Error in set_number_of_saves_all ; dt must be set"; exit(-1);} }
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
void set_save_count_all(int new_)
Definition: MD.h:156
Mdouble tmax
Definition: MD.h:672
void MD::set_number_of_saves_data ( Mdouble  N)
inline

Definition at line 173 of file MD.h.

References dt, save_count_data, and tmax.

173 {if (dt) {save_count_data = (N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000; } else {std::cerr << "Error in set_number_of_saves_data ; dt must be set"; exit(-1);} }
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
Mdouble tmax
Definition: MD.h:672
int save_count_data
These are informations for saving.
Definition: MD.h:675
void MD::set_number_of_saves_ene ( Mdouble  N)
inline

Definition at line 174 of file MD.h.

References dt, save_count_ene, and tmax.

174 {if (dt) {save_count_ene = (N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000; } else {std::cerr << "Error in set_number_of_saves_ene ; dt must be set"; exit(-1);} }
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
int save_count_ene
Definition: MD.h:676
Mdouble tmax
Definition: MD.h:672
void MD::set_number_of_saves_fstat ( Mdouble  N)
inline

Definition at line 176 of file MD.h.

References dt, save_count_fstat, and tmax.

176 {if (dt) {save_count_fstat = (N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000; } else {std::cerr << "Error in set_number_of_saves_fstat; dt must be set"; exit(-1);} }
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
int save_count_fstat
Definition: MD.h:678
Mdouble tmax
Definition: MD.h:672
void MD::set_number_of_saves_stat ( Mdouble  N)
inline

Definition at line 175 of file MD.h.

References dt, save_count_stat, and tmax.

175 {if (dt) {save_count_stat = (N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000; } else {std::cerr << "Error in set_number_of_saves_stat ; dt must be set"; exit(-1);} }
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
int save_count_stat
Definition: MD.h:677
Mdouble tmax
Definition: MD.h:672
void MD::set_plastic_k1_k2max_kc_depth ( Mdouble  k1_,
Mdouble  k2max_,
Mdouble  kc_,
Mdouble  depth_,
unsigned int  indSpecies = 0 
)
inline

Allows the plastic constants to be changed.

Todo:
{these functions should also update the mixed species}

Definition at line 181 of file MD.h.

References Species.

182  {if (indSpecies<Species.size()) {Species[indSpecies].set_plastic_k1_k2max_kc_depth(k1_, k2max_, kc_, depth_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_restart_version ( int  new_)
inline

Sets restart_version.

Definition at line 374 of file MD.h.

References restart_version.

374 {restart_version=new_;}
int restart_version
Definition: MD.h:700
void MD::set_restarted ( bool  new_)
inline

Definition at line 383 of file MD.h.

References restarted, and set_append().

Referenced by constructor(), and load_restart_data().

383  {
384  restarted=new_;
385  set_append(new_);
386  }
void set_append(bool new_)
Sets restarted.
Definition: MD.h:391
bool restarted
Definition: MD.h:701
void MD::set_rho ( Mdouble  new_,
unsigned int  indSpecies = 0 
)
inline

Allows the density to be changed.

Definition at line 220 of file MD.h.

References Species.

Referenced by constructor(), load_par_ini_file(), and readNextArgument().

220 {if (indSpecies<Species.size()) {Species[indSpecies].set_rho(new_);} else {std::cerr << "Error in set_rho: species does not exist"; exit(-1);}}
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void MD::set_rotation ( bool  new_)
inline

Definition at line 257 of file MD.h.

References rotation.

257 {rotation=new_;}
bool rotation
Definition: MD.h:721
void MD::set_save_count_all ( int  new_)
inline

Definition at line 156 of file MD.h.

References save_count_data, save_count_ene, save_count_fstat, and save_count_stat.

Referenced by constructor(), set_number_of_saves_all(), and set_savecount().

156 {if (new_>0) {save_count_data =new_;save_count_ene =new_;save_count_stat =new_;save_count_fstat=new_;} else {std::cerr << "Error in set_save_count_all (set_save_count_all("<<new_<<"))"<< std::endl; exit(-1);}}
int save_count_ene
Definition: MD.h:676
int save_count_stat
Definition: MD.h:677
int save_count_fstat
Definition: MD.h:678
int save_count_data
These are informations for saving.
Definition: MD.h:675
void MD::set_save_count_data ( int  new_)
inline

Definition at line 157 of file MD.h.

References save_count_data.

Referenced by load_par_ini_file(), and readNextArgument().

157 {if (new_>0) {save_count_data =new_;} else {std::cerr << "Error in set_save_count_data, (set_save_count_data ("<<new_<<"))"<< std::endl; exit(-1);}}
int save_count_data
These are informations for saving.
Definition: MD.h:675
void MD::set_save_count_ene ( int  new_)
inline

Definition at line 158 of file MD.h.

References save_count_ene.

Referenced by readNextArgument().

158 {if (new_>0) {save_count_ene =new_;} else {std::cerr << "Error in set_save_count_ene, (set_save_count_ene ("<<new_<<"))"<< std::endl; exit(-1);}}
int save_count_ene
Definition: MD.h:676
void MD::set_save_count_fstat ( int  new_)
inline

Definition at line 160 of file MD.h.

References save_count_fstat.

Referenced by load_par_ini_file(), and readNextArgument().

160 {if (new_>0) {save_count_fstat=new_;} else {std::cerr << "Error in set_save_count_fstat, (set_save_count_fstat("<<new_<<"))"<< std::endl; exit(-1);}}
int save_count_fstat
Definition: MD.h:678
void MD::set_save_count_stat ( int  new_)
inline

Definition at line 159 of file MD.h.

References save_count_stat.

Referenced by readNextArgument().

159 {if (new_>0) {save_count_stat =new_;} else {std::cerr << "Error in set_save_count_stat, (set_save_count_stat ("<<new_<<"))"<< std::endl; exit(-1);}}
int save_count_stat
Definition: MD.h:677
void MD::set_savecount ( int  new_)
inline

Allows the number of time steps between saves to be changed, see also set_number_of_saves.

Definition at line 155 of file MD.h.

References set_save_count_all().

Referenced by load_par_ini_file(), ChuteBottom::make_rough_bottom(), and readNextArgument().

155 {if (new_>0) {set_save_count_all(new_);} else {std::cerr << "Error in set_savecount (set_savecount("<<new_<<"))"<< std::endl; exit(-1);}}
void set_save_count_all(int new_)
Definition: MD.h:156
void MD::set_t ( Mdouble  new_t)
inline

Access function for the time.

Definition at line 110 of file MD.h.

References t.

Referenced by load_par_ini_file().

110 {t=new_t;}
Mdouble t
This stores the current time.
Definition: MD.h:687
void MD::set_tmax ( Mdouble  new_tmax)
inline

Allows the upper time limit to be changed.

Definition at line 142 of file MD.h.

References tmax.

Referenced by load_par_ini_file(), ChuteBottom::make_rough_bottom(), and readNextArgument().

142 {if (new_tmax>=0){tmax=new_tmax;} else { std::cerr << "Error in set_tmax, new_tmax="<<new_tmax << std::endl; exit(-1); }}
Mdouble tmax
Definition: MD.h:672
void MD::set_xballs_additional_arguments ( std::string  new_)
inline

Set the additional arguments for xballs.

Definition at line 354 of file MD.h.

References xballs_additional_arguments.

354 {xballs_additional_arguments=new_.c_str();}
std::string xballs_additional_arguments
Definition: MD.h:698
void MD::set_xballs_cmode ( int  new_cmode)
inline

Definition at line 346 of file MD.h.

References xballs_cmode.

346 {xballs_cmode=new_cmode;}
int xballs_cmode
Definition: MD.h:695
void MD::set_xballs_colour_mode ( int  new_cmode)
inline

Set the xball output mode.

Definition at line 345 of file MD.h.

References xballs_cmode.

345 {xballs_cmode=new_cmode;}
int xballs_cmode
Definition: MD.h:695
void MD::set_xballs_scale ( Mdouble  new_scale)
inline

Set the scale of the xballs problem. The default is fit to screen.

Definition at line 358 of file MD.h.

References xballs_scale.

358 {xballs_scale=new_scale;}
Mdouble xballs_scale
Definition: MD.h:697
void MD::set_xballs_vector_scale ( double  new_vscale)
inline

Set the scale of vectors in xballs.

Definition at line 350 of file MD.h.

References xballs_vscale.

350 {xballs_vscale=new_vscale;}
Mdouble xballs_vscale
Definition: MD.h:696
void MD::set_xmax ( Mdouble  new_xmax)
inline

Sets xmax and walls, assuming the standard definition of walls as in the default constructor.

Definition at line 328 of file MD.h.

References xmax, and xmin.

Referenced by readNextArgument(), Chute::set_ChuteLength(), ChuteWithHopperAndInset::set_ChuteLength(), ChuteWithHopper::set_ChuteLength(), ChuteWithHopperAndInset::set_shift(), and ChuteWithHopper::set_shift().

328 {if (new_xmax>=xmin){xmax=new_xmax;} else { std::cerr << "Error in set_xmax(" << new_xmax << "): xmin=" << xmin << std::endl; exit(-1); }}
Mdouble xmax
Definition: MD.h:668
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
void MD::set_xmin ( Mdouble  new_xmin)
inline

Sets xmin and walls, assuming the standard definition of walls as in the default constructor.

Definition at line 318 of file MD.h.

References xmax, and xmin.

Referenced by readNextArgument(), ChuteWithHopperAndInset::set_ChuteLength(), and ChuteWithHopper::set_ChuteLength().

318 {if (new_xmin<=xmax){xmin=new_xmin;} else { std::cerr << "Warning in set_xmin(" << new_xmin << "): xmax=" << xmax << std::endl; }}
Mdouble xmax
Definition: MD.h:668
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
void MD::set_ymax ( Mdouble  new_ymax)
inline

Sets ymax and walls, assuming the standard definition of walls as in the default constructor.

Definition at line 331 of file MD.h.

References ymax, and ymin.

Referenced by readNextArgument(), and Chute::set_ChuteWidth().

331 {if (new_ymax>ymin){ymax=new_ymax;} else { std::cerr << "Warning in set_ymax(" << new_ymax << "): ymin=" << ymin << std::endl; }}
Mdouble ymin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
void MD::set_ymin ( Mdouble  new_ymin)
inline

Definition at line 320 of file MD.h.

References ymax, and ymin.

Referenced by readNextArgument().

320 {if (new_ymin<=ymax){ymin=new_ymin;} else { std::cerr << "Error in set_ymin(" << new_ymin << "): ymax=" << ymax << std::endl; exit(-1); }}
Mdouble ymin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
void MD::set_zmax ( Mdouble  new_zmax)
inline

Sets ymax and walls, assuming the standard definition of walls as in the default constructor.

Definition at line 334 of file MD.h.

References ymin, zmax, and zmin.

Referenced by ChuteWithHopperAndInset::add_hopper(), ChuteWithHopper::add_hopper(), Chute::readNextArgument(), readNextArgument(), and Chute::set_InflowHeight().

334 {if (new_zmax>ymin){zmax=new_zmax;} else { std::cerr << "Error in set_zmax(" << new_zmax << "): zmin=" << zmin << std::endl; exit(-1); }}
Mdouble zmax
Definition: MD.h:668
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
void MD::set_zmin ( Mdouble  new_zmin)
inline

Sets ymin and walls, assuming the standard definition of walls as in the default constructor.

Definition at line 324 of file MD.h.

References zmax, and zmin.

Referenced by readNextArgument().

324 {if (new_zmin<=zmax){zmin=new_zmin;} else { std::cerr << "Warning in set_zmin(" << new_zmin << "): zmax=" << zmax << std::endl; }}
Mdouble zmax
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
void MD::setup_particles_initial_conditions ( )
virtual

This function allows the initial conditions of the particles to be set, by default locations is random.

This setup the particles initial conditions it is virtual as you expect the user to override this.

Remember particle properties must also be defined here.

Todo:
I (Anthony) wants to change this to be an external function. This has a lot of advantages espcially when using copy-constructors. This is a major change and will break other codes, so therefore has to be done carefully.

By default the particles are randomly disibuted///

Reimplemented in ChuteBottom, ChuteWithHopper, ChuteWithHopperAndInset, Chute, and ChuteWithHopperAndInset.

Definition at line 120 of file MD.cc.

Referenced by set_dt(), and solve().

121 {
122 }
void MD::solve ( )

The work horse of the code.

This is the main solve loop where all the action takes place///.

This is where the main code works

Print counter if it is used

Set up the data file names

Initialise the time and sets up the initial conditions for the simulation

Todo:
Is it neccesarry to reset initial conditions here and in set_dt (i.e. should it be in constructor)? Thomas: I agree, set_dt should be rewritten to work without calling setup_particles_initial_conditions

Set up the data file names

This creates the file the data will be saved to

Set up the ene file names

This creates the file ene will be saved to

Set up the fstat file names

This creates the file fstatistics will be saved to

initializes PrevPosition if PositionVerlet is used

Setup the mass of each particle.

Other initializations

velocity verlet requires initial force calculation

Todo:
{Thomas: the tangential spring should not be integrated here, but in the integration function; currently, the integration is supressed by setting dt=0, but sliding tangential springs are integrated}
Bug:
This CmakeDeftions is current not included and should be readded. Currectly cause a strange compliler error, which I (Ant) do not follow

This is the main loop over advancing time

Here we output to the data file

Todo:
{When do we actually want to output force and location data?}

Check if rotation is on

Loop over all particles doing the time integration step

Output statistical information

Compute forces

bug{In chute particles are added in actions_before_time_set(), however they are not written to the xballs data yet, but can have a collison and be written to the fstat data}

Loop over all particles doing the time integration step

Definition at line 2266 of file MD.cc.

References actions_after_solve(), actions_after_time_step(), actions_before_time_loop(), actions_before_time_step(), append, BaseHandler< T >::begin(), boundaryHandler, Check_and_Duplicate_Periodic_Particles(), checkInteractionWithBoundaries(), compute_all_forces(), compute_particle_masses(), continue_solve(), cout_time(), create_xballs_script(), STD_save::data_file, do_integration_after_force_computation(), do_integration_before_force_computation(), do_stat_always, dt, BaseHandler< T >::end(), ene_ela, STD_save::ene_file, finish_statistics(), STD_save::fstat_file, fstat_header(), get_append(), STD_save::get_counter(), get_mu(), STD_save::get_options_data(), STD_save::get_options_ene(), STD_save::get_options_fstat(), STD_save::get_options_restart(), STD_save::get_options_stat(), BaseParticle::get_Position(), BaseParticle::get_Radius(), BaseParticle::get_Velocity(), getLargestParticle(), BaseHandler< T >::getObject(), getParticleHandler(), gravity, HGRID_actions_after_integration(), HGRID_actions_before_integration(), HGRID_actions_before_time_loop(), HGRID_actions_before_time_step(), STD_save::increase_counter_data(), STD_save::increase_counter_ene(), STD_save::increase_counter_fstat(), STD_save::increase_counter_stat(), initialize_statistics(), max_radius, STD_save::open_data_file(), STD_save::open_ene_file(), STD_save::open_fstat_file(), output_ene(), output_statistics(), output_xballs_data(), particleHandler, PeriodicCreated, STD_save::problem_name, process_statistics(), random, Remove_Duplicate_Periodic_Particles(), restarted, rotation, save_count_data, save_count_ene, save_count_fstat, save_count_stat, save_data_data, save_data_ene, save_data_fstat, save_data_stat, save_restart_data(), STD_save::set_data_filename(), STD_save::set_ene_filename(), STD_save::set_fstat_filename(), set_initial_pressures_for_pressure_controlled_walls(), setup_particles_initial_conditions(), Species, start_ene(), t, tmax, and wallHandler.

Referenced by ChuteBottom::make_rough_bottom(), and solve().

2267 {
2268  #ifdef DEBUG_OUTPUT
2269  std::cerr << "Entered solve" << std::endl;
2270  #endif
2271  #ifdef ContactListHgrid
2272  std::cout << "Using ContactListHgrid"<<std::endl;
2273  #endif
2274 
2276 
2278  //if (get_counter()) std::cout << "Count: " << get_counter() << std::endl;
2279  //else std::cout << "Started to solve ..." << std::endl;
2280 
2282  if (get_counter()>0) problem_name << "." << get_counter();
2283 
2288  if (!restarted) {
2289  t=0;
2291  #ifdef DEBUG_OUTPUT
2292  std::cerr << "Have created the particles initial conditions " << std::endl;
2293  #endif
2294  }
2295 
2296 
2299 
2300  //undo append if data file does not exist
2301  //~ std::cout << " get_data_filename()" << get_data_filename() << ", append" << append << ", access" << access(get_data_filename().c_str(), F_OK ) << std::endl;
2302  //~ if (append && (access(get_data_filename().c_str(), F_OK ) == -1) ) {
2303  //~ append = false;
2304  //~ std::cerr << "Warning: cannot append because data file does not exist; set append to false." << std::endl;
2305  //~ }
2306  if (get_append()) {
2307  if (get_options_data()==2) increase_counter_data(std::fstream::out);
2308  if (get_options_ene()==2) increase_counter_ene(std::fstream::out);
2309  if (get_options_stat()==2) increase_counter_stat(std::fstream::out);
2310  if (get_options_fstat()==2) increase_counter_fstat(std::fstream::out);
2311  }
2312 
2313  std::fstream::openmode mode;
2314  if (append) mode=std::fstream::out|std::fstream::app;
2315  else mode=std::fstream::out;
2316 
2318  if(!open_data_file(mode)) {std::cerr << "Problem opening data file aborting" << std::endl; exit(-1);}
2319 
2321  set_ene_filename();
2322 
2324  if(!open_ene_file(mode)){std::cerr << "Problem opening ene file aborting" << std::endl; exit(-1);}
2325 
2328 
2330  if(!open_fstat_file(mode)){std::cerr << "Problem opening fstat file aborting" << std::endl; exit(-1);}
2331 
2333  #ifdef USE_SIMPLE_VERLET_INTEGRATION
2334  std::cout << "using simple verlet integration" << std::endl;
2335  for (int i = 0;i<Particles.size();i++)
2337  #endif
2338 
2341 
2347 
2348  ene_ela = 0;
2349  if (!append) start_ene();
2350 
2351  //needed for output_statistics
2352  save_data_data =false;
2353  save_data_ene =false;
2354  save_data_stat =false;
2355  save_data_fstat=false;
2356 
2362  Mdouble dt_=dt; dt=0; compute_all_forces(); dt=dt_;
2366  #ifdef DEBUG_OUTPUT
2367  std::cerr << "Have computed the initial values for the forces " << std::endl;
2368  #endif
2369 
2370  if (append) {
2371  save_data_data =false;
2372  save_data_ene =false;
2373  save_data_stat =false;
2374  save_data_fstat=false;
2375  } else {
2376  save_data_data =true;
2377  save_data_ene =true;
2378  save_data_stat =true;
2379  save_data_fstat=true;
2380  }
2381 
2382  int count_data=1;
2383  int count_ene=1;
2384  int count_stat=1;
2385  int count_fstat=1;
2386  //create .disp file if .data file is created
2389  //if ((get_options_data()) && (xballsSupportOn()=="ON")) create_xballs_script();
2390 
2391  ene_ela = 0;
2393  while (t-dt<tmax&&continue_solve())
2394  {
2395  for (std::vector<BaseBoundary*>::iterator it = boundaryHandler.begin(); it!=boundaryHandler.end(); ++it)
2396  {
2397  (*it)->checkBoundaryActionsBeforeTimeStep(particleHandler,wallHandler,random);
2398  }
2401  if (save_data_data)
2402  {
2403  if (get_options_data()==2) increase_counter_data(std::fstream::out);
2405  }
2406  if (save_data_ene)
2407  {
2408  if (get_options_ene()==2) increase_counter_ene(std::fstream::out);
2409  }
2410  if(save_data_stat)
2411  {
2412  if (get_options_stat()==2) increase_counter_stat(std::fstream::out);
2413  }
2414  if (save_data_fstat)
2415  {
2416  if (get_options_fstat()==2) increase_counter_fstat(std::fstream::out);
2417  }
2418 
2420  rotation=false;
2421  for (unsigned int i=0;i<Species.size();i++) {
2422  if (Species[i].get_mu()||Species[i].get_murolling()||Species[i].get_mutorsion())
2423  rotation = true;
2424  for (unsigned int j=0;j<Species[i].MixedSpecies.size();j++) {
2425  if (Species[i].MixedSpecies[j].get_mu()||Species[i].MixedSpecies[j].get_murolling()||Species[i].MixedSpecies[j].get_mutorsion())
2426  rotation = true;
2427  }
2428  }
2429 
2432  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it)
2433  {
2435  }
2438 
2442 
2444 
2448 
2450 
2452 
2453 
2457 
2460  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it)
2461  {
2463  }
2466 
2467  if (save_data_ene) output_ene();
2468 
2470 
2471  t+=dt;
2472 
2473  //To write the last time step (acutaly data is written at t+0.5*dt where t alreay is larger then tmax)
2474  if (count_data == save_count_data || t>tmax) //write data
2475  {
2476  save_data_data=true;
2477  count_data=1;
2478  cout_time();
2479  }
2480  else
2481  {
2482  save_data_data=false;
2483  count_data++;
2484  }
2485  if (count_ene == save_count_ene || t>tmax) //write data
2486  {
2487  save_data_ene=true;
2488  count_ene=1;
2489  }
2490  else
2491  {
2492  save_data_ene=false;
2493  count_ene++;
2494  }
2495  if (count_fstat == save_count_fstat || t>tmax) //write data
2496  {
2497  save_data_fstat=true;
2498  count_fstat=1;
2499  }
2500  else
2501  {
2502  save_data_fstat=false;
2503  count_fstat++;
2504  }
2505  if (count_stat == save_count_stat || t>tmax) //write data
2506  {
2507  save_data_stat=true;
2508  count_stat=1;
2509  }
2510  else
2511  {
2512  save_data_stat=false;
2513  count_stat++;
2514  }
2515 
2516  }
2517  //end loop over interaction count
2519 
2520  std::cout << std::endl;
2521  //To make sure get_t gets the correct time for outputting statistics
2523 
2524  data_file.close();
2525 
2526  ene_file.close();
2527 
2528  fstat_file.close();
2529 
2530 }
std::fstream fstat_file
Definition: STD_save.h:254
bool save_data_fstat
Definition: MD.h:681
virtual void cout_time()
std::couts time
Definition: MD.h:621
virtual void setup_particles_initial_conditions()
This function allows the initial conditions of the particles to be set, by default locations is rando...
Definition: MD.cc:120
virtual void output_ene()
This function outputs statistical data - The default is to compute the rotational kinetic engergy...
Definition: MD.cc:175
bool open_fstat_file(std::fstream::openmode mode=std::fstream::out)
Definition: STD_save.h:184
const Vec3D & get_Velocity() const
bool get_append()
Gets restarted.
Definition: MD.h:389
virtual void start_ene()
Functions for ene file.
Definition: MD.cc:127
bool restarted
Definition: MD.h:701
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
virtual void do_integration_after_force_computation(BaseParticle *pI)
This is were the integration is done.
Definition: MD.cc:1843
void set_fstat_filename()
Definition: STD_save.h:143
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:220
bool rotation
Definition: MD.h:721
virtual void actions_after_solve()
This is actions at the end of the code, but before the files are closed.
Definition: MD.h:567
bool do_stat_always
Definition: MD.h:683
unsigned int get_options_fstat(void)
Definition: STD_save.h:159
virtual BaseParticle * getLargestParticle()
Definition: MD.h:419
void Remove_Duplicate_Periodic_Particles()
Remove periodic duplicate Particles (i.e. removes particles created by Check_and_Duplicate_Periodic_P...
Definition: MD.cc:2703
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
void set_data_filename()
Definition: STD_save.h:144
RNG random
Definition: MD.h:515
WallHandler wallHandler
Definition: MD.h:708
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
virtual void save_restart_data()
Stores all MD data.
Definition: MD.cc:654
Mdouble get_Radius() const
virtual bool continue_solve()
Definition: MD.h:630
std::fstream data_file
Stream used for data files.
Definition: STD_save.h:252
void compute_particle_masses()
Computes the mass of each particle.
Definition: MD.h:618
virtual void set_initial_pressures_for_pressure_controlled_walls()
Definition: MD.h:587
bool save_data_ene
Definition: MD.h:680
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
virtual void process_statistics(bool usethese UNUSED)
Definition: MD.h:585
virtual void actions_after_time_step()
This is action after the time step is finished.
Definition: MD.h:570
virtual void do_integration_before_force_computation(BaseParticle *pI)
This is were the integration is done.
Definition: MD.cc:1773
virtual void actions_before_time_loop()
This is actions before the start of the main time loop.
Definition: MD.h:545
unsigned int get_options_data(void)
Definition: STD_save.h:162
virtual void fstat_header()
Definition: MD.cc:145
Mdouble max_radius
Definition: MD.h:665
virtual void finish_statistics()
Definition: MD.h:586
Mdouble t
This stores the current time.
Definition: MD.h:687
int save_count_ene
Definition: MD.h:676
double Mdouble
Definition: ExtendedMath.h:33
bool increase_counter_fstat(std::fstream::openmode mode)
Definition: STD_save.h:217
virtual void HGRID_actions_after_integration()
Definition: MD.h:596
bool append
Definition: MD.h:720
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:233
virtual void actions_before_time_step()
This is action before the time step is started.
Definition: MD.h:564
virtual void initialize_statistics()
Functions for statistics.
Definition: MD.h:582
bool save_data_stat
Definition: MD.h:682
virtual void compute_all_forces()
This does the force computation.
Definition: MD.cc:1935
virtual void output_statistics()
Definition: MD.h:583
int PeriodicCreated
Definition: MD.h:722
bool open_data_file(std::fstream::openmode mode=std::fstream::out)
Definition: STD_save.h:187
unsigned int get_options_ene(void)
Definition: STD_save.h:171
const Vec3D & get_Position() const
bool save_data_data
Definition: MD.h:679
int save_count_stat
Definition: MD.h:677
unsigned int get_options_stat(void)
Definition: STD_save.h:165
unsigned int get_options_restart(void)
Definition: STD_save.h:168
int get_counter()
This returns the current value of the counter.
Definition: STD_save.cc:85
virtual void HGRID_actions_before_integration()
Definition: MD.h:595
virtual void output_xballs_data()
Output xball data for Particle i.
Definition: MD.cc:209
Mdouble get_mu(unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be accessed.
Definition: MD.h:247
virtual void HGRID_actions_before_time_loop()
This is actions before the start of the main time loop.
Definition: MD.h:552
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
Mdouble ene_ela
used in force calculations
Definition: MD.h:690
ParticleHandler & getParticleHandler()
Definition: MD.h:147
bool increase_counter_ene(std::fstream::openmode mode)
Definition: STD_save.h:228
int save_count_fstat
Definition: MD.h:678
virtual void HGRID_actions_before_time_step()
This is action before the time step is started.
Definition: MD.h:555
bool increase_counter_data(std::fstream::openmode mode)
Definition: STD_save.h:221
Mdouble tmax
Definition: MD.h:672
virtual void checkInteractionWithBoundaries()
Definition: MD.cc:1794
bool increase_counter_stat(std::fstream::openmode mode)
Definition: STD_save.h:224
bool open_ene_file(std::fstream::openmode mode=std::fstream::out)
Definition: STD_save.h:193
int save_count_data
These are informations for saving.
Definition: MD.h:675
void set_ene_filename()
Definition: STD_save.h:146
int Check_and_Duplicate_Periodic_Particles()
Calls Check_and_Duplicate_Periodic_Particle for all Particles curently in Particles[] and returns the...
Definition: MD.cc:2719
std::fstream ene_file
Definition: STD_save.h:255
virtual void create_xballs_script()
This creates a scipt which can be used to load the xballs problem to display the data just generated...
Definition: MD_xballs.icc:84
void MD::solve ( unsigned int  argc,
char *  argv[] 
)
inline

Read arguments before solving.

Definition at line 99 of file MD.h.

References readArguments(), and solve().

99  {
100  readArguments(argc, argv);
101  solve();
102  };
int readArguments(unsigned int argc, char *argv[])
Can interpret main function input arguments that are passed by the driver codes.
Definition: MD.cc:2535
void solve()
The work horse of the code.
Definition: MD.cc:2266
void MD::solveWithMDCLR ( )

Tries to solve the problem using MDCLR.

void MD::start_ene ( )
protectedvirtual

Functions for ene file.

This function gathers statistical data.

todo{Why is there a +6 here?}

Definition at line 127 of file MD.cc.

References STD_save::ene_file, and get_append().

Referenced by solve(), and statistics_from_restart_data().

128 {
129  //only write if we don't restart
130  if (get_append()||!ene_file.is_open()) return;
131 
133  static int width = ene_file.precision() + 6;
134  ene_file
135  << std::setw(width) << "t" << " "
136  << std::setw(width) << "ene_gra" << " "
137  << std::setw(width) << "ene_kin" << " "
138  << std::setw(width) << "ene_rot" << " "
139  << std::setw(width) << "ene_ela" << " "
140  << std::setw(width) << "X_COM" << " "
141  << std::setw(width) << "Y_COM" << " "
142  << std::setw(width) << "Z_COM" << std::endl;
143 }
bool get_append()
Gets restarted.
Definition: MD.h:389
std::fstream ene_file
Definition: STD_save.h:255
void MD::statistics_from_restart_data ( const char *  name)

Loads all MD data and plots statistics for all timesteps in the .data file.

statistics_from_restart_data

todo{Check this whole function}

Definition at line 1890 of file MD.cc.

References actions_after_time_step(), actions_before_time_loop(), actions_before_time_step(), Check_and_Duplicate_Periodic_Particles(), compute_all_forces(), compute_particle_masses(), STD_save::data_file, STD_save::data_filename, HGRID_actions_before_time_loop(), HGRID_actions_before_time_step(), initialize_statistics(), load_from_data_file(), load_restart_data(), output_ene(), PeriodicCreated, Remove_Duplicate_Periodic_Particles(), save_data_data, save_data_ene, save_data_fstat, save_data_stat, start_ene(), STD_save::stat_file, STD_save::stat_filename, and t.

1891 {
1893  //This function loads all MD data
1895 
1896  //This creates the file statistics will be saved to
1897  stat_filename.str("");
1898  stat_filename << name << ".stat";
1899  stat_file.open( stat_filename.str().c_str() , std::fstream::out);
1900 
1901 
1902  // Sets up the initial conditions for the simulation
1903  // setup_particles_initial_conditions();
1904  // Setup the previous position arrays and mass of each particle.
1906  // Other routines required to jump-start the simulation
1910  start_ene();
1911 
1912  while (load_from_data_file(data_filename.str().c_str())) {
1917  save_data_data = true;
1918  save_data_ene = true;
1919  save_data_stat = true;
1920  save_data_fstat= true;
1924  output_ene();
1925  std::cout << std::setprecision(6) << t << std::endl;
1926  }
1927 
1928  data_file.close();
1929  stat_file.close();
1930 }
bool save_data_fstat
Definition: MD.h:681
virtual void output_ene()
This function outputs statistical data - The default is to compute the rotational kinetic engergy...
Definition: MD.cc:175
std::stringstream stat_filename
Definition: STD_save.h:247
std::fstream stat_file
Definition: STD_save.h:253
std::stringstream data_filename
These store the save file names, by default they are derived from problem_name.
Definition: STD_save.h:246
virtual void start_ene()
Functions for ene file.
Definition: MD.cc:127
bool load_from_data_file(const char *filename, unsigned int format=0)
This allows particle data to be reloaded from data files.
Definition: MD.cc:250
void Remove_Duplicate_Periodic_Particles()
Remove periodic duplicate Particles (i.e. removes particles created by Check_and_Duplicate_Periodic_P...
Definition: MD.cc:2703
std::fstream data_file
Stream used for data files.
Definition: STD_save.h:252
void compute_particle_masses()
Computes the mass of each particle.
Definition: MD.h:618
bool save_data_ene
Definition: MD.h:680
virtual void actions_after_time_step()
This is action after the time step is finished.
Definition: MD.h:570
virtual void actions_before_time_loop()
This is actions before the start of the main time loop.
Definition: MD.h:545
Mdouble t
This stores the current time.
Definition: MD.h:687
virtual void actions_before_time_step()
This is action before the time step is started.
Definition: MD.h:564
virtual void initialize_statistics()
Functions for statistics.
Definition: MD.h:582
bool save_data_stat
Definition: MD.h:682
virtual void compute_all_forces()
This does the force computation.
Definition: MD.cc:1935
int PeriodicCreated
Definition: MD.h:722
bool save_data_data
Definition: MD.h:679
int load_restart_data()
Loads all MD data.
Definition: MD.cc:685
virtual void HGRID_actions_before_time_loop()
This is actions before the start of the main time loop.
Definition: MD.h:552
virtual void HGRID_actions_before_time_step()
This is action before the time step is started.
Definition: MD.h:555
int Check_and_Duplicate_Periodic_Particles()
Calls Check_and_Duplicate_Periodic_Particle for all Particles curently in Particles[] and returns the...
Definition: MD.cc:2719
void MD::write ( std::ostream &  os)
virtual

Writes all MD data.

Reimplemented in ChuteWithHopper, ChuteWithHopperAndInset, Chute, and HGRID_base.

Definition at line 1985 of file MD.cc.

References WallHandler::begin(), BaseHandler< T >::begin(), boundaryHandler, dim, dt, WallHandler::end(), BaseHandler< T >::end(), BaseHandler< T >::getNumberOfObjects(), WallHandler::getNumberOfWalls(), gravity, STD_save::options_data, STD_save::options_ene, STD_save::options_fstat, STD_save::options_restart, particleHandler, STD_save::problem_name, save_count_data, save_count_ene, save_count_fstat, Species, t, tmax, wallHandler, xmax, xmin, ymax, ymin, zmax, and zmin.

Referenced by save_restart_data(), and HGRID_base::write().

1985  {
1986  os
1987  << "restart_version " << 3
1988  << std::endl
1989  << "name " << problem_name.str()
1990  << std::endl
1991  << "xmin " << xmin << " xmax " << xmax
1992  << " ymin " << ymin << " ymax " << ymax
1993  << " zmin " << zmin << " zmax " << zmax
1994  << std::endl
1995  << "dt " << dt
1996  << " t " << t
1997  << " tmax " << tmax
1998  << " save_count_data " << save_count_data
1999  << " save_count_ene " << save_count_ene
2000  << " save_count_stat " << save_count_fstat
2001  << " save_count_fstat " << save_count_fstat
2002  << std::endl
2003  << "dim " << dim
2004  << " gravity " << gravity
2005  << std::endl
2006  << "options_fstat " << options_fstat
2007  << " options_data " << options_data
2008  << " options_ene " << options_ene
2009  << " options_restart " << options_restart
2010  << std::endl;
2011  os<< "Species " << Species.size() << std::endl;
2012  for (std::vector<CSpecies>::iterator it = Species.begin(); it!=Species.end(); ++it) {
2013  os << (*it) << std::endl;
2014  for (std::vector<CSpecies>::iterator it2 = it->MixedSpecies.begin(); it2!=it->MixedSpecies.end(); ++it2) os << (*it2) << " (mixed)" << std::endl;
2015  }
2016  os<< "Walls " << wallHandler.getNumberOfWalls() << std::endl;
2017  for (std::vector<BaseWall*>::iterator it = wallHandler.begin(); it!=wallHandler.end(); ++it) os << (**it) << std::endl;
2018  os<< "Boundaries " << boundaryHandler.getNumberOfObjects() << std::endl;
2019  for (std::vector<BaseBoundary*>::iterator it = boundaryHandler.begin(); it!=boundaryHandler.end(); ++it) os << (**it) << std::endl;
2020  os<< "Particles " << particleHandler.getNumberOfObjects() << std::endl;
2021  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it) os << (**it) << std::endl;
2022  //should be optional: os << "FixedParticles " << data_FixedParticles << std::endl;
2023 }
unsigned int options_restart
Definition: STD_save.h:266
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:220
unsigned int options_fstat
Indicators if files are created or not 0: file will not be created 1: file will be written in one fil...
Definition: STD_save.h:262
int dim
The dimension of the simulation.
Definition: MD.h:660
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
WallHandler wallHandler
Definition: MD.h:708
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
const std::vector< BaseWall * >::const_iterator begin() const
Gets the begin of the const_iterator over all BaseWall in this WallHandler.
Definition: WallHandler.cc:242
Mdouble xmax
Definition: MD.h:668
const std::vector< BaseWall * >::const_iterator end() const
Gets the end of the const_iterator over all BaseWall in this WallHandler.
Definition: WallHandler.cc:254
Mdouble t
This stores the current time.
Definition: MD.h:687
int save_count_ene
Definition: MD.h:676
Mdouble zmax
Definition: MD.h:668
unsigned int getNumberOfWalls() const
Gets the number of BaseWalls in this WallHandler.
Definition: WallHandler.cc:224
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:233
unsigned int options_ene
Definition: STD_save.h:265
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
int save_count_fstat
Definition: MD.h:678
Mdouble tmax
Definition: MD.h:672
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
unsigned int options_data
Definition: STD_save.h:263
int save_count_data
These are informations for saving.
Definition: MD.h:675
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
void MD::write_v1 ( std::ostream &  os)
virtual

Writes all MD data.

Definition at line 2198 of file MD.cc.

References WallHandler::begin(), BaseHandler< T >::begin(), boundaryHandler, dim, dt, WallHandler::end(), BaseHandler< T >::end(), BaseHandler< T >::getNumberOfObjects(), WallHandler::getNumberOfWalls(), gravity, max_radius, STD_save::options_data, STD_save::options_ene, STD_save::options_fstat, particleHandler, STD_save::problem_name, save_count_data, Species, t, tmax, wallHandler, xmax, xmin, ymax, ymin, zmax, and zmin.

2199 {
2200  os << dim << " " << gravity << " "
2201  << xmin << " " << xmax << " " << ymin << " " << ymax << " " << zmin << " " << zmax << " "
2202  << dt << " " << t << " " << tmax << " "
2203  << save_count_data << " " << max_radius << " "
2204  << problem_name.str() << " "
2205  << Species.size() << " "
2206  << particleHandler.getNumberOfObjects() << " "
2207  << wallHandler.getNumberOfWalls() << " "
2208  << boundaryHandler.getNumberOfObjects() << std::endl;
2209  os << options_fstat << " " << options_data << " " << options_ene << std::endl;
2210  for (std::vector<CSpecies>::iterator it = Species.begin(); it!=Species.end(); ++it) os << (*it) << std::endl;
2211  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it) os << (**it) << std::endl;
2212  for (std::vector<BaseWall*>::iterator it = wallHandler.begin(); it!=wallHandler.end(); ++it) os << (**it) << std::endl;
2213  for (std::vector<BaseBoundary*>::iterator it = boundaryHandler.begin(); it!=boundaryHandler.end(); ++it) os << (**it) << std::endl;
2214 }
const std::vector< T * >::const_iterator begin() const
Gets the begin of the const_iterator over all Object in this BaseHandler.
Definition: BaseHandler.h:220
unsigned int options_fstat
Indicators if files are created or not 0: file will not be created 1: file will be written in one fil...
Definition: STD_save.h:262
int dim
The dimension of the simulation.
Definition: MD.h:660
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
WallHandler wallHandler
Definition: MD.h:708
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
const std::vector< BaseWall * >::const_iterator begin() const
Gets the begin of the const_iterator over all BaseWall in this WallHandler.
Definition: WallHandler.cc:242
Mdouble xmax
Definition: MD.h:668
const std::vector< BaseWall * >::const_iterator end() const
Gets the end of the const_iterator over all BaseWall in this WallHandler.
Definition: WallHandler.cc:254
Mdouble max_radius
Definition: MD.h:665
Mdouble t
This stores the current time.
Definition: MD.h:687
Mdouble zmax
Definition: MD.h:668
unsigned int getNumberOfWalls() const
Gets the number of BaseWalls in this WallHandler.
Definition: WallHandler.cc:224
const std::vector< T * >::const_iterator end() const
Gets the end of the const_iterator over all BaseBoundary in this BaseHandler.
Definition: BaseHandler.h:233
unsigned int options_ene
Definition: STD_save.h:265
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
Mdouble tmax
Definition: MD.h:672
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
unsigned int options_data
Definition: STD_save.h:263
int save_count_data
These are informations for saving.
Definition: MD.h:675
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
MD md 
)
friend

Definition at line 498 of file MD.h.

498  {
499  md.print(os);
500  return os;
501  }
virtual void print(std::ostream &os, bool print_all=false)
Outputs MD.
Definition: MD.cc:1806

Member Data Documentation

bool MD::append
private

Definition at line 720 of file MD.h.

Referenced by get_append(), set_append(), and solve().

int MD::data_FixedParticles
private

Definition at line 702 of file MD.h.

Referenced by constructor(), read(), read_next_from_data_file(), and read_v2().

int MD::dim
private

The dimension of the simulation.

Definition at line 660 of file MD.h.

Referenced by constructor(), create_xballs_script(), get_dim(), output_xballs_data(), print(), read(), read_next_from_data_file(), read_v2(), set_dim(), write(), and write_v1().

bool MD::do_stat_always
private
Mdouble MD::ene_ela
private

used in force calculations

Definition at line 690 of file MD.h.

Referenced by add_ene_ela(), compute_plastic_internal_forces(), get_ene_ela(), set_ene_ela(), and solve().

int MD::format
private

Definition at line 699 of file MD.h.

Referenced by constructor(), create_xballs_script(), get_format(), output_xballs_data(), and set_format().

Vec3D MD::gravity
private

Gravitational acceleration.

Definition at line 663 of file MD.h.

Referenced by constructor(), get_gravity(), print(), read(), read_v1(), read_v2(), Chute::set_ChuteAngle(), set_gravity(), solve(), write(), and write_v1().

Mdouble MD::max_radius
private

Definition at line 665 of file MD.h.

Referenced by get_max_radius(), read_v1(), solve(), and write_v1().

int MD::PeriodicCreated
private
int MD::restart_version
private

Definition at line 700 of file MD.h.

Referenced by get_restart_version(), read(), and set_restart_version().

bool MD::restarted
private

Definition at line 701 of file MD.h.

Referenced by get_restarted(), set_restarted(), and solve().

bool MD::rotation
private
int MD::save_count_data
private

These are informations for saving.

Definition at line 675 of file MD.h.

Referenced by get_save_count_data(), print(), read(), read_v1(), read_v2(), set_number_of_saves_data(), set_save_count_all(), set_save_count_data(), solve(), write(), and write_v1().

int MD::save_count_ene
private
int MD::save_count_fstat
private
int MD::save_count_stat
private
bool MD::save_data_data
private

Definition at line 679 of file MD.h.

Referenced by get_save_data_data(), solve(), and statistics_from_restart_data().

bool MD::save_data_ene
private
bool MD::save_data_fstat
private
bool MD::save_data_stat
private
int MD::save_restart_data_counter
private

Definition at line 723 of file MD.h.

Referenced by constructor(), and save_restart_data().

std::vector<CSpecies> MD::Species
protected

These are the particle parameters like dissipation etc.

Definition at line 655 of file MD.h.

Referenced by add_Species(), compute_internal_forces(), compute_particle_masses(), compute_plastic_internal_forces(), compute_walls(), constructor(), Chute::create_inflow_particle(), ChuteWithHopper::create_inflow_particle(), ChuteWithHopperAndInset::create_inflow_particle(), Chute::get_collision_time(), get_collision_time(), get_depth(), get_dim_particle(), get_disp(), get_disprolling(), get_dispt(), get_disptorsion(), get_dissipation(), get_k(), get_k1(), get_k2max(), get_kc(), get_krolling(), get_kt(), get_ktorsion(), Chute::get_LightestParticleMass(), get_Mass_from_Radius(), get_maximum_velocity(), get_MixedSpecies(), get_mu(), get_murolling(), get_mutorsion(), get_NSpecies(), get_plastic_dt(), Chute::get_restitution_coefficient(), get_restitution_coefficient(), get_rho(), get_Species(), Chute::getLargestParticle(), Chute::getSmallestParticle(), Chute::initialize_inflow_particle(), print(), read(), read_next_from_data_file(), read_v1(), read_v2(), Chute::readNextArgument(), readNextArgument(), set_collision_time_and_normal_and_tangential_restitution_coefficient(), set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt(), Chute::set_collision_time_and_restitution_coefficient(), set_collision_time_and_restitution_coefficient(), set_depth(), set_dim_particle(), set_disp(), set_disprolling(), set_dispt(), set_disptorsion(), set_dissipation(), set_dt(), set_k(), set_k1(), set_k2max(), set_k_and_restitution_coefficient(), set_kc(), set_krolling(), set_kt(), set_ktorsion(), set_MixedSpecies(), set_mu(), set_murolling(), set_mutorsion(), set_plastic_k1_k2max_kc_depth(), set_rho(), ChuteBottom::setup_particles_initial_conditions(), solve(), write(), and write_v1().

WallHandler MD::wallHandler
private
std::string MD::xballs_additional_arguments
private
int MD::xballs_cmode
private
Mdouble MD::xballs_scale
private

Definition at line 697 of file MD.h.

Referenced by constructor(), create_xballs_script(), get_xballs_scale(), and set_xballs_scale().

Mdouble MD::xballs_vscale
private
Mdouble MD::xmin
private

These store the size of the domain, assume walls at the ends.

Definition at line 668 of file MD.h.

Referenced by constructor(), create_xballs_script(), get_xmin(), output_xballs_data(), print(), read(), read_dim_from_data_file(), read_next_from_data_file(), read_v1(), read_v2(), set_xmax(), set_xmin(), write(), and write_v1().


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