MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StatisticsVector< T > Class Template Reference

This class is used to extract statistical data from MD simulations. More...

#include <StatisticsPoint.h>

+ Inheritance diagram for StatisticsVector< T >:

Public Member Functions

void constructor ()
 Sets up all basic things. More...
 
void constructor (std::string name)
 
 StatisticsVector ()
 Basic constructor only calls constructor() More...
 
 StatisticsVector (std::string name)
 
 StatisticsVector (StatisticsVector &other)
 Copy constructor. More...
 
 StatisticsVector (unsigned int argc, char *argv[])
 Advanced constructor that accepts arguments from the command line. More...
 
void readStatArguments (unsigned int argc, char *argv[])
 
std::string print ()
 Outputs member variable values to a std::string. More...
 
void set_statType ()
 
void print_help ()
 
void set_nx (int new_)
 
void set_hx (Mdouble hx)
 
void set_ny (int new_)
 
void set_hy (Mdouble hy)
 
void set_nz (int new_)
 
void set_hz (Mdouble hz)
 
void set_n (int n)
 
void set_h (Mdouble h)
 
int get_nx ()
 
int get_ny ()
 
int get_nz ()
 
void set_tminStat (Mdouble t)
 
void set_tmaxStat (Mdouble t)
 
void set_tintStat (Mdouble t)
 
Mdouble get_tminStat ()
 
Mdouble get_tmaxStat ()
 
Mdouble get_tintStat ()
 
bool check_current_time_for_statistics ()
 
void set_CG_type (const char *new_)
 
void set_CG_type (CG new_)
 
CG get_CG_type ()
 
void set_n (int nx_, int ny_, int nz_)
 
void get_n (int &nx_, int &ny_, int &nz_)
 
void set_w (Mdouble w)
 Set CG variables w2 and CG_invvolume. More...
 
void set_w2 (Mdouble new_)
 Set CG variables w2 and CG_invvolume. More...
 
Mdouble get_w ()
 
Mdouble get_w2 ()
 
Mdouble get_cutoff ()
 
Mdouble get_cutoff2 ()
 
std::string print_CG ()
 Output coarse graining variables. More...
 
StatisticsPoint< T > average (std::vector< StatisticsPoint< T > > &P)
 Output average of statistical variables. More...
 
virtual void reset_statistics ()
 Set all statistical variables to zero. More...
 
void statistics_from_fstat_and_data ()
 get StatisticsPoint More...
 
void statistics_from_p3 ()
 this is a modified version of statistics_from_fstat_and_data. It is used to read p3d files More...
 
void jump_p3c ()
 get force statistics from particle collisions More...
 
void set_doTimeAverage (bool new_)
 
bool get_doTimeAverage ()
 
void set_StressTypeForFixedParticles (int new_)
 
int get_StressTypeForFixedParticles ()
 
void set_infiniteStressForFixedParticles (bool new_)
 
void set_mirrorAtDomainBoundary (Mdouble new_)
 
Mdouble get_mirrorAtDomainBoundary ()
 
void set_doVariance (bool new_)
 
bool get_doVariance ()
 
void set_doGradient (bool new_)
 
bool get_doGradient ()
 
void set_superexact (bool new_)
 
bool get_superexact ()
 
void set_ignoreFixedParticles (bool new_)
 
bool get_ignoreFixedParticles ()
 
void verbose ()
 
void set_verbosity (int new_)
 
int get_verbosity ()
 
void set_walls (bool new_)
 
bool get_walls ()
 
void set_periodicWalls (bool new_)
 
bool get_periodicWalls ()
 
void set_w_over_rmax (Mdouble new_)
 
Mdouble get_w_over_rmax ()
 
void set_Positions ()
 Set position of StatisticsPoint points and set variables to 0. More...
 
bool read_next_from_data_file (unsigned int format)
 
void gather_force_statistics_from_fstat_and_data ()
 get force statistics from particle collisions More...
 
void gather_force_statistics_from_p3c (int version)
 get force statistics from particle collisions More...
 
void gather_force_statistics_from_p3w (int version, std::vector< int > &index)
 get force statistics from particle collisions More...
 
void evaluate_force_statistics (int wp=0)
 get force statistics More...
 
void evaluate_wall_force_statistics (Vec3D P, int wp=0)
 get force statistics (i.e. first particle is a wall particle) More...
 
void jump_fstat ()
 
void initialize_statistics ()
 Initializes statistics, i.e. setting w2, setting the grid and writing the header lines in the .stat file. More...
 
void output_statistics ()
 Calculates statistics for Particles (i.e. not collisions) More...
 
void gather_statistics_collision (int index1, int index2, Vec3D Contact, Mdouble delta, Mdouble ctheta, Mdouble fdotn, Mdouble fdott, Vec3D P1_P2_normal_, Vec3D P1_P2_tangential)
 Calculates statistics for one collision (can be any kind of collision) More...
 
void process_statistics (bool usethese)
 Processes all gathered statistics and resets them afterwards. (Processing means either calculating time averages or writing out statistics) More...
 
void finish_statistics ()
 Finish all statistics (i.e. write out final data) More...
 
void write_statistics ()
 Writes regular statistics. More...
 
void write_time_average_statistics ()
 Writes out time averaged statistics. More...
 
void evaluate_particle_statistics (std::vector< BaseParticle * >::iterator P, int wp=0)
 Calculates statistics for a single Particle. More...
 
std::vector< StatisticsPoint< T > > get_Points ()
 
Mdouble get_xminStat ()
 Functions to acces and change the domain of statistics. More...
 
Mdouble get_yminStat ()
 
Mdouble get_zminStat ()
 
Mdouble get_xmaxStat ()
 
Mdouble get_ymaxStat ()
 
Mdouble get_zmaxStat ()
 
void set_xminStat (Mdouble xminStat_)
 
void set_yminStat (Mdouble yminStat_)
 
void set_zminStat (Mdouble zminStat_)
 
void set_xmaxStat (Mdouble xmaxStat_)
 
void set_ymaxStat (Mdouble ymaxStat_)
 
void set_zmaxStat (Mdouble zmaxStat_)
 
int get_nTimeAverage ()
 
Mdouble setInfinitelyLongDistance ()
 
void set_Polynomial (std::vector< Mdouble > new_coefficients, unsigned int new_dim)
 
void set_Polynomial (Mdouble *new_coefficients, unsigned int num_coeff, unsigned int new_dim)
 
void set_PolynomialName (const char *new_name)
 
std::string get_PolynomialName ()
 
void set_doublePoints (bool new_)
 
bool get_doublePoints ()
 
void set_TimeAverageReset (int new_)
 
bool get_TimeAverageReset ()
 
void set_rmin (Mdouble new_)
 
void set_rmax (Mdouble new_)
 
void set_hmax (Mdouble new_)
 
Mdouble evaluatePolynomial (Mdouble r)
 
Mdouble evaluatePolynomialGradient (Mdouble r)
 
Mdouble evaluateIntegral (Mdouble n1, Mdouble n2, Mdouble t)
 
template<>
void set_nz (int new_ UNUSED)
 
template<>
void set_ny (int new_ UNUSED)
 
template<>
void set_nx (int new_ UNUSED)
 
template<>
void set_ny (int new_ UNUSED)
 
template<>
void set_nz (int new_ UNUSED)
 
template<>
void set_nx (int new_ UNUSED)
 
template<>
void set_nz (int new_ UNUSED)
 
template<>
void set_nx (int new_ UNUSED)
 
template<>
void set_ny (int new_ UNUSED)
 
template<>
void set_nx (int new_ UNUSED)
 
template<>
void set_ny (int new_ UNUSED)
 
template<>
void set_nz (int new_ UNUSED)
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
void set_statType ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
Mdouble setInfinitelyLongDistance ()
 
template<>
double setInfinitelyLongDistance ()
 
- Public Member Functions inherited from MD
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 ()
 

Protected Member Functions

bool satisfiesInclusionCriteria (BaseParticle *P)
 
bool loadVelocityProfile (const char *filename)
 
Vec3D getVelocityProfile (Vec3D Position)
 
bool read_next_from_p3p_file ()
 
void auto_setdim ()
 
- Protected Member Functions inherited from MD
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 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

StatType statType
 Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are averaged; f.e. StatType X is averaged over y and z. More...
 
int nx
 Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat,xmaxStat]x[yminStat,ymaxStat]x[zminStat,zmaxStat]. More...
 
int ny
 see nx More...
 
int nz
 see nx More...
 
Mdouble xminStat
 By default the points of evaluation are placed in an grid on the domain [xminStat,xmaxStat]x[yminStat,ymaxStat]x[zminStat,zmaxStat]. More...
 
Mdouble xmaxStat
 
Mdouble yminStat
 
Mdouble ymaxStat
 
Mdouble zminStat
 
Mdouble zmaxStat
 
int nxMirrored
 extension of grid size from mirrored points More...
 
int nyMirrored
 
int nzMirrored
 
std::vector< StatisticsPoint< T > > Points
 A vector that stores the values of the statistical variables at a given position. More...
 
std::vector< StatisticsPoint< T > > dx
 A vector that stores the gradient in x of all statistical variables at a given position. More...
 
std::vector< StatisticsPoint< T > > dy
 A vector that stores the gradient in y of all statistical variables at a given position. More...
 
std::vector< StatisticsPoint< T > > dz
 A vector that stores the gradient in z of all statistical variables at a given position. More...
 
std::vector< StatisticsPoint< T > > timeAverage
 A vector used to sum up all statistical values in Points for time-averaging. More...
 
std::vector< StatisticsPoint< T > > timeVariance
 a vector used to sum up the variance in time of all statistical values More...
 
std::vector< StatisticsPoint< T > > dxTimeAverage
 a vector used to sum up all statistical gradients in dx for time-averaging More...
 
std::vector< StatisticsPoint< T > > dyTimeAverage
 a vector used to sum up all statistical gradients in dy for time-averaging More...
 
std::vector< StatisticsPoint< T > > dzTimeAverage
 a vector used to sum up all statistical gradients in dz for time-averaging More...
 
bool doTimeAverage
 Determines if output is averaged over time. More...
 
int nTimeAverageReset
 Determines after how many timesteps the time average is reset. More...
 
bool doVariance
 Determines if variance is outputted. More...
 
bool doGradient
 Determines if gradient is outputted. More...
 
int nTimeAverage
 A counter needed to average over time. More...
 
CG CG_type
 coarse graining type (Gaussian, Heaviside, Polynomial) More...
 
NORMALIZED_POLYNOMIAL< T > CGPolynomial
 Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r. More...
 
Mdouble w2
 coarse graining width squared; for HeavisideSphere and Gaussian More...
 
Mdouble cutoff
 The distance from the origin at which the cg function vanishes; cutoff=w for HeavisideSphere or Polynomial, 3*w for Gaussian. More...
 
Mdouble cutoff2
 
Mdouble w_over_rmax
 if w is not set manually then w will be set by multiplying this value by the largest particle radius at t=0 More...
 
Mdouble tminStat
 Statistical output will only be created if t>tminStat. More...
 
Mdouble tmaxStat
 Statistical output will only be created if t<tmaxStat. More...
 
Mdouble tintStat
 Statistical output will only be created if tmaxStat-tintStat< t< tmaxStat. More...
 
Mdouble indSpecies
 defines the species for which statistics are extracted (-1 for all species) More...
 
Mdouble rmin
 defines the minimum radius of the particles for which statistics are extracted More...
 
Mdouble rmax
 defines the maximum radius of the particles for which statistics are extracted More...
 
Mdouble hmax
 defines the maximum height of the particles for which statistics are extracted More...
 
bool walls
 Turns off walls before evaluation. More...
 
bool periodicWalls
 Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if particle is in domain) More...
 
bool ignoreFixedParticles
 Determines if fixed particles contribute to particle statistics (density, ...) More...
 
int StressTypeForFixedParticles
 0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowing Particle COM (default) 2 Stress from fixed particles distributed between fixed and flowing Particle COM 3 Stress from fixed particles extends from flowing particle to infinity More...
 
int verbosity
 0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters) More...
 
int format
 
Mdouble mirrorAtDomainBoundary
 
bool isMDCLR
 
bool superexact
 If true, cutoff radius for Gaussian is set to 5*w (from 3*w) More...
 
bool doublePoints
 
Vec3D P1
 Position of first contact point. More...
 
Vec3D P2
 Position of second contact point. More...
 
Vec3D P1_P2_normal
 Direction of contact. More...
 
Mdouble P1_P2_distance
 Length of contact line. More...
 
Matrix3D P1_P2_NormalStress
 Contact stress from normal forces along the line of contact. More...
 
Matrix3D P1_P2_ContactCoupleStress
 
Vec3D P1_P2_Contact
 
Matrix3D P1_P2_TangentialStress
 Contact stress from tangential forces along the line of contact. More...
 
Vec3D P1_P2_NormalTraction
 Traction from normal forces at contact of flow with fixed particles or walls. More...
 
Vec3D P1_P2_TangentialTraction
 Traction from tangential forces at contact of flow with fixed particles or walls. More...
 
MatrixSymmetric3D P1_P2_Fabric
 Fabric. More...
 
Vec3D P1_P2_CollisionalHeatFlux
 not yet working More...
 
Mdouble P1_P2_Dissipation
 not yet working More...
 
Mdouble P1_P2_Potential
 not yet working More...
 
std::vector< Vec3DVelocityProfile
 
Vec3D VelocityProfile_Min
 
Vec3D VelocityProfile_D
 
std::fstream p3p_file
 
std::fstream p3c_file
 
std::fstream p3w_file
 
- Protected Attributes inherited from MD
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
 

Additional Inherited Members

- Public Attributes inherited from MD
RNG random
 

Detailed Description

template<StatType T>
class StatisticsVector< T >

This class is used to extract statistical data from MD simulations.

When calling statistics_from_fstat_and_data(), statistical data (such as density, pressure, ...) will be extracted at various points in the domain, aligned in a nx*ny*nz grid.

Set functions can be used to define the dimensions of the grid (default: nx=ny=nz=1) and the type and width of the coarse graining function (default: Gaussian, width w=r_max).

Definition at line 30 of file StatisticsPoint.h.

Constructor & Destructor Documentation

template<StatType T>
StatisticsVector< T >::StatisticsVector ( )
inline

Basic constructor only calls constructor()

Definition at line 56 of file StatisticsVector.h.

References StatisticsVector< T >::constructor().

56 {constructor();}
void constructor()
Sets up all basic things.
template<StatType T>
StatisticsVector< T >::StatisticsVector ( std::string  name)
inline

Definition at line 57 of file StatisticsVector.h.

References StatisticsVector< T >::constructor().

57 {constructor(name);}
void constructor()
Sets up all basic things.
template<StatType T>
StatisticsVector< T >::StatisticsVector ( StatisticsVector< T > &  other)

Copy constructor.

Definition at line 139 of file StatisticsVector.hcc.

References StatisticsVector< T >::CG_type, StatisticsVector< T >::CGPolynomial, StatisticsVector< T >::constructor(), StatisticsVector< T >::cutoff, StatisticsVector< T >::cutoff2, StatisticsVector< T >::doGradient, StatisticsVector< T >::doTimeAverage, StatisticsVector< T >::doVariance, StatisticsVector< T >::dx, StatisticsVector< T >::dxTimeAverage, StatisticsVector< T >::dy, StatisticsVector< T >::dyTimeAverage, StatisticsVector< T >::dz, StatisticsVector< T >::dzTimeAverage, StatisticsVector< T >::format, StatisticsVector< T >::hmax, StatisticsVector< T >::ignoreFixedParticles, StatisticsVector< T >::indSpecies, StatisticsVector< T >::isMDCLR, StatisticsVector< T >::mirrorAtDomainBoundary, StatisticsVector< T >::nTimeAverage, StatisticsVector< T >::nx, StatisticsVector< T >::nxMirrored, StatisticsVector< T >::ny, StatisticsVector< T >::nyMirrored, StatisticsVector< T >::nz, StatisticsVector< T >::nzMirrored, StatisticsVector< T >::periodicWalls, StatisticsVector< T >::Points, StatisticsVector< T >::rmax, StatisticsVector< T >::rmin, StatisticsVector< T >::StressTypeForFixedParticles, StatisticsVector< T >::superexact, StatisticsVector< T >::timeAverage, StatisticsVector< T >::timeVariance, StatisticsVector< T >::tintStat, StatisticsVector< T >::tmaxStat, StatisticsVector< T >::tminStat, StatisticsVector< T >::verbosity, StatisticsVector< T >::w2, StatisticsVector< T >::w_over_rmax, StatisticsVector< T >::walls, StatisticsVector< T >::xmaxStat, StatisticsVector< T >::xminStat, StatisticsVector< T >::ymaxStat, StatisticsVector< T >::yminStat, StatisticsVector< T >::zmaxStat, and StatisticsVector< T >::zminStat.

139  : MD()
140 {
141  //assumes that we want the statistical method copied, but resets the time averaging
142  constructor();
143  //~ StatType statType; //this has to be constant, right?
144  nx = other.nx;
145  ny = other.ny;
146  nz = other.nz;
147  xminStat = other.xminStat;
148  yminStat = other.yminStat;
149  zminStat = other.zminStat;
150  xmaxStat = other.xmaxStat;
151  ymaxStat = other.ymaxStat;
152  zmaxStat = other.zmaxStat;
153  nxMirrored = other.nxMirrored;
154  nyMirrored = other.nyMirrored;
155  nzMirrored = other.nzMirrored;
156  Points = other.Points;
157  dx = other.dx;
158  dy = other.dy;
159  dz = other.dz;
160 
161  timeAverage = other.timeAverage;
162  timeVariance = other.timeVariance;
167  nTimeAverage = 0;
168  for (unsigned int i=0; i<timeAverage.size(); i++) timeAverage[i].set_zero();
169  for (unsigned int i=0; i<timeVariance.size(); i++) timeVariance[i].set_zero();
170  for (unsigned int i=0; i<dxTimeAverage.size(); i++) dxTimeAverage[i].set_zero();
171  for (unsigned int i=0; i<dyTimeAverage.size(); i++) dyTimeAverage[i].set_zero();
172  for (unsigned int i=0; i<dzTimeAverage.size(); i++) dzTimeAverage[i].set_zero();
173  doVariance = other.doVariance;
174  doGradient = other.doGradient;
175  CG_type = other.CG_type;
176  CGPolynomial = other.CGPolynomial;
177  w2 = other.w2;
178  cutoff = other.cutoff;
179  cutoff2 = other.cutoff2;
180  w_over_rmax = other.w_over_rmax;
181  tminStat = other.tminStat;
182  tmaxStat = other.tmaxStat;
183  tintStat = other.tintStat;
184  rmin = other.rmin;
185  rmax = other.rmax;
186  hmax = other.hmax;
187  indSpecies = other.indSpecies;
188  walls = other.walls;
192  verbosity = other.verbosity;
193  format = other.format;
195  isMDCLR = other.isMDCLR;
196  superexact = other.superexact;
197 }
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
std::vector< StatisticsPoint< T > > dyTimeAverage
a vector used to sum up all statistical gradients in dy for time-averaging
bool walls
Turns off walls before evaluation.
Mdouble w_over_rmax
if w is not set manually then w will be set by multiplying this value by the largest particle radius ...
Mdouble tmaxStat
Statistical output will only be created if t
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
Mdouble cutoff
The distance from the origin at which the cg function vanishes; cutoff=w for HeavisideSphere or Polyn...
std::vector< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
Mdouble xminStat
By default the points of evaluation are placed in an grid on the domain [xminStat,xmaxStat]x[yminStat,ymaxStat]x[zminStat,zmaxStat].
void constructor()
Sets up all basic things.
Mdouble w2
coarse graining width squared; for HeavisideSphere and Gaussian
Mdouble tintStat
Statistical output will only be created if tmaxStat-tintStat< t< tmaxStat.
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
MD()
Definition: MD.h:75
int nTimeAverage
A counter needed to average over time.
std::vector< StatisticsPoint< T > > dxTimeAverage
a vector used to sum up all statistical gradients in dx for time-averaging
std::vector< StatisticsPoint< T > > dzTimeAverage
a vector used to sum up all statistical gradients in dz for time-averaging
Mdouble indSpecies
defines the species for which statistics are extracted (-1 for all species)
Mdouble tminStat
Statistical output will only be created if t>tminStat.
Mdouble rmin
defines the minimum radius of the particles for which statistics are extracted
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
bool doTimeAverage
Determines if output is averaged over time.
std::vector< StatisticsPoint< T > > timeVariance
a vector used to sum up the variance in time of all statistical values
Mdouble mirrorAtDomainBoundary
bool doVariance
Determines if variance is outputted.
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
CG CG_type
coarse graining type (Gaussian, Heaviside, Polynomial)
Mdouble hmax
defines the maximum height of the particles for which statistics are extracted
std::vector< StatisticsPoint< T > > timeAverage
A vector used to sum up all statistical values in Points for time-averaging.
bool superexact
If true, cutoff radius for Gaussian is set to 5*w (from 3*w)
bool ignoreFixedParticles
Determines if fixed particles contribute to particle statistics (density, ...)
int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
Mdouble rmax
defines the maximum radius of the particles for which statistics are extracted
bool doGradient
Determines if gradient is outputted.
int nxMirrored
extension of grid size from mirrored points
template<StatType T>
StatisticsVector< T >::StatisticsVector ( unsigned int  argc,
char *  argv[] 
)

Advanced constructor that accepts arguments from the command line.

Definition at line 224 of file StatisticsVector.hcc.

225 {
226  //check if filename is given
227  if (argc<2) {
228  std::cerr<<"fstatistics.exe filename [-options]"<< std::endl
229  << "Type -help for more information" << std::endl;
230  exit(-1);
231  }
232 
233  //print help if required
234  if (!strcmp(argv[1],"-help")) {
235  print_help();
236  }
237 
238  //create StatisticsVector
239  std::string filename(argv[1]);
240  constructor(filename);
241 
242  //check for options (standardly '-option argument')
243  readStatArguments(argc, argv);
244 }
void constructor()
Sets up all basic things.
void readStatArguments(unsigned int argc, char *argv[])

Member Function Documentation

template<StatType T>
void StatisticsVector< T >::auto_setdim ( )
protected

Definition at line 948 of file StatisticsVector.hcc.

948  {
949  if (getParticleHandler().getNumberOfObjects()<1) return;
950  std::vector<BaseParticle*>::iterator it = getParticleHandler().begin();
951  set_xmin((*it)->get_Position().X-(*it)->get_Radius());
952  set_ymin((*it)->get_Position().Y-(*it)->get_Radius());
953  set_zmin((*it)->get_Position().Z-(*it)->get_Radius());
954  set_xmax((*it)->get_Position().X+(*it)->get_Radius());
955  set_ymax((*it)->get_Position().Y+(*it)->get_Radius());
956  set_zmax((*it)->get_Position().Z+(*it)->get_Radius());
957  for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
958  set_xmin(std::min(get_xmin(),(*it)->get_Position().X-(*it)->get_Radius()));
959  set_ymin(std::min(get_ymin(),(*it)->get_Position().Y-(*it)->get_Radius()));
960  set_zmin(std::min(get_zmin(),(*it)->get_Position().Z-(*it)->get_Radius()));
961  set_xmax(std::max(get_xmax(),(*it)->get_Position().X+(*it)->get_Radius()));
962  set_ymax(std::max(get_ymax(),(*it)->get_Position().Y+(*it)->get_Radius()));
963  set_zmax(std::max(get_zmax(),(*it)->get_Position().Z+(*it)->get_Radius()));
964  } //end for all particles
965 }
Mdouble get_zmin()
Gets zmin.
Definition: MD.h:313
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_zmin(Mdouble new_zmin)
Sets ymin and walls, assuming the standard definition of walls as in the default constructor.
Definition: MD.h:324
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
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
Mdouble get_ymax()
Gets ymax.
Definition: MD.h:311
Mdouble get_ymin()
Gets ymin.
Definition: MD.h:309
Mdouble get_xmin()
Get xmin.
Definition: MD.h:305
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 set_ymax(Mdouble new_ymax)
Sets ymax and walls, assuming the standard definition of walls as in the default constructor.
Definition: MD.h:331
ParticleHandler & getParticleHandler()
Definition: MD.h:147
Mdouble get_xmax()
Get xmax.
Definition: MD.h:307
void set_ymin(Mdouble new_ymin)
Definition: MD.h:320
Mdouble get_zmax()
Gets zmax.
Definition: MD.h:315
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
template<StatType T>
StatisticsPoint< T > StatisticsVector< T >::average ( std::vector< StatisticsPoint< T > > &  P)

Output average of statistical variables.

Output names of statistical variables.

Definition at line 649 of file StatisticsVector.hcc.

References StatisticsPoint< T >::set_zero().

649  {
650  StatisticsPoint<T> avg;
651  avg.set_zero();
652  for (unsigned int i=0; i<P.size(); i++) avg += P[i];
653  avg /= P.size();
654  return avg;
655 }
void set_zero()
Sets all statistical variables to zero.
This class stores statistical values for a given spatial position; to be used in combination with Sta...
template<StatType T>
bool StatisticsVector< T >::check_current_time_for_statistics ( )
inline

Definition at line 91 of file StatisticsVector.h.

References MD::get_dt(), MD::get_t(), StatisticsVector< T >::get_tmaxStat(), and StatisticsVector< T >::get_tminStat().

91 {return (get_t()>get_tminStat()&&get_t()<=get_tmaxStat()+get_dt());};
Mdouble get_tminStat()
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
Mdouble get_tmaxStat()
template<StatType T>
void StatisticsVector< T >::constructor ( )

Sets up all basic things.

Definition at line 74 of file StatisticsVector.hcc.

References Gaussian, and StatisticsPoint< T >::set_gb().

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

74  {
75  //stores the template parameter Stattype in a variable
76  set_statType();
77 
78  // sets connection between StatisticsPoint and StatisticsVector
80  // set nx, ny,nz
81  nx = ny = nz = 1;
83 
84  // set default CG variables
85  CG_type = Gaussian;
86  // in get_statistics_..., w2 is set to w_over_rmax*rmax if w2==0
87  w_over_rmax = 1;
88 
89  // bounded domain
90  //~ boundedDomain = false;
91 
92  // set default values; variables will only be used if the default
93  // is overwritten; thus the default is a nonsense value
94  w2 = 0.0;
95  set_tintStat(0);
96  set_tminStat(-1e20);
97  set_tmaxStat(NAN);
98  rmin = 0;
99  hmax = 1e20;
100  rmax = 1e20;
101  indSpecies = -1; //all species
102 
103 
104  //set default options - Not used it physially don't make sense i.e if ?max<?min
105  xminStat = NAN;
106  xmaxStat = NAN;
107  yminStat = NAN;
108  ymaxStat = NAN;
109  zminStat = NAN;
110  zmaxStat = NAN;
111 
112 
113  // set default options
114  ignoreFixedParticles = true; //this should be true if you want statistics only of the flow
116  verbosity = 1;
117  walls = true;
118  periodicWalls = true;
119  format = 0;
120  mirrorAtDomainBoundary = false;
121  set_superexact(false);
122  VelocityProfile.resize(0); //equivalent to do not use velocityprofile
123 
124  // time averaging
125  set_doTimeAverage(true);
126  nTimeAverage = 0;
127  nTimeAverageReset = -1;
128  //calculate variance
129  set_doVariance(false);
130  //calculate gradient
131  set_doGradient(false);
132  doublePoints=false;
133 
134  // additional stuff
135  set_options_stat(1);
136 }
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
bool walls
Turns off walls before evaluation.
Mdouble w_over_rmax
if w is not set manually then w will be set by multiplying this value by the largest particle radius ...
std::vector< Vec3D > VelocityProfile
Mdouble xminStat
By default the points of evaluation are placed in an grid on the domain [xminStat,xmaxStat]x[yminStat,ymaxStat]x[zminStat,zmaxStat].
Mdouble w2
coarse graining width squared; for HeavisideSphere and Gaussian
void set_tmaxStat(Mdouble t)
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
int nTimeAverage
A counter needed to average over time.
void set_doTimeAverage(bool new_)
int nTimeAverageReset
Determines after how many timesteps the time average is reset.
void set_tminStat(Mdouble t)
Mdouble indSpecies
defines the species for which statistics are extracted (-1 for all species)
Mdouble rmin
defines the minimum radius of the particles for which statistics are extracted
void set_doVariance(bool new_)
void set_doGradient(bool new_)
void set_superexact(bool new_)
Mdouble mirrorAtDomainBoundary
void set_tintStat(Mdouble t)
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
CG CG_type
coarse graining type (Gaussian, Heaviside, Polynomial)
Mdouble hmax
defines the maximum height of the particles for which statistics are extracted
bool ignoreFixedParticles
Determines if fixed particles contribute to particle statistics (density, ...)
static void set_gb(StatisticsVector< T > *new_gb)
see StatisticsVector::set_CG_type
int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
void set_options_stat(unsigned int new_)
Definition: STD_save.h:164
Mdouble rmax
defines the maximum radius of the particles for which statistics are extracted
int nxMirrored
extension of grid size from mirrored points
template<StatType T>
void StatisticsVector< T >::constructor ( std::string  name)

Definition at line 202 of file StatisticsVector.hcc.

202  {
203  //call default constructor
204  constructor();
205 
206  // set name
207  set_name(name.c_str());
208 
209  if (!strcmp(get_name().c_str(),"c3d")) {
210  //write here what to do with Stefan's data
211  std::cout << "MDCLR data" << std::endl;
212  exit(-1);
213  } else {
214  //write here what to do with Mercury data
215  isMDCLR = false;
217  set_append(false);
218  //~ set_tmaxStat(t+dt); //note:doesn't work if restart data is not the latest
219  }
220 }
void set_append(bool new_)
Sets restarted.
Definition: MD.h:391
void constructor()
Sets up all basic things.
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
std::string get_name()
Allows the problem_name to be accessed.
Definition: STD_save.h:127
template<StatType T>
void StatisticsVector< T >::evaluate_force_statistics ( int  wp = 0)

get force statistics

todo{What are P1 and P2 over here?}

Todo:
{TW: Couple stress calculation works only for Gaussians}

Definition at line 1719 of file StatisticsVector.hcc.

References Cross(), PeriodicBoundary::distance(), PeriodicBoundary::shift_positions(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

1720 {
1722  if(periodicWalls)
1723  for (unsigned int k=wp; k<getBoundaryHandler().getNumberOfObjects(); k++)
1724  {
1726  if(b0)
1727  {
1728  b0->distance(P1);
1729  b0->shift_positions(P1,P2);
1731  b0->shift_positions(P1,P2);
1732  }
1733  }
1734 
1736  //evaluate fields that only depend on CParticle parameters
1737  Mdouble psi; //Course graining integral
1738  Vec3D rpsi=Vec3D(0,0,0);
1739  static unsigned int counter = 0;
1740  for (unsigned int i=0; i<Points.size(); i++) {
1741  psi = Points[i].CG_integral(P1, P2, P1_P2_normal, P1_P2_distance, rpsi);
1742  if (psi) {
1743  counter++;
1744  if (!std::isfinite(psi)) {
1745  std::cerr << "error: psi =" << psi << " is infinite for P1=" << P1 << ", P2=" << P2 << ", t=" << get_t() << std::endl;
1746  psi=0;
1747  }
1748  Points[i].ContactCoupleStress += (Cross(P1_P2_Contact*psi,P1_P2_ContactCoupleStress) - Cross(rpsi,P1_P2_ContactCoupleStress))*(-0.5);
1749  Points[i].NormalStress += P1_P2_NormalStress * psi;
1750  Points[i].TangentialStress += P1_P2_TangentialStress * psi;
1751  Points[i].Fabric += P1_P2_Fabric * psi;
1752  Points[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * psi;
1753  Points[i].Dissipation += P1_P2_Dissipation * psi;
1754  Points[i].Potential += P1_P2_Potential * psi;
1755  if (get_doGradient()) {
1756  Vec3D d_psi = Points[i].CG_integral_gradient(P1, P2, P1_P2_normal, P1_P2_distance);
1757 
1758  dx[i].NormalStress += P1_P2_NormalStress * d_psi.X;
1759  dx[i].TangentialStress += P1_P2_TangentialStress * d_psi.X;
1760  dx[i].Fabric += P1_P2_Fabric * d_psi.X;
1761  dx[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * d_psi.X;
1762  dx[i].Dissipation += P1_P2_Dissipation * d_psi.X;
1763  dx[i].Potential += P1_P2_Potential * d_psi.X;
1764 
1765  dy[i].NormalStress += P1_P2_NormalStress * d_psi.Y;
1766  dy[i].TangentialStress += P1_P2_TangentialStress * d_psi.Y;
1767  dy[i].Fabric += P1_P2_Fabric * d_psi.Y;
1768  dy[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * d_psi.Y;
1769  dy[i].Dissipation += P1_P2_Dissipation * d_psi.Y;
1770  dy[i].Potential += P1_P2_Potential * d_psi.Y;
1771 
1772  dz[i].NormalStress += P1_P2_NormalStress * d_psi.Z;
1773  dz[i].TangentialStress += P1_P2_TangentialStress * d_psi.Z;
1774  dz[i].Fabric += P1_P2_Fabric * d_psi.Z;
1775  dz[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * d_psi.Z;
1776  dz[i].Dissipation += P1_P2_Dissipation * d_psi.Z;
1777  dz[i].Potential += P1_P2_Potential * d_psi.Z;
1778  } //end if get_doGradient
1779  } //end if phi
1780  } // end forall Points
1781  //std::cout << "NCeval" << counter << std::endl;
1782 }
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
Mdouble X
Definition: Vector.h:44
Vec3D P2
Position of second contact point.
int counter
The stores the run number for saving.
Definition: STD_save.h:238
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
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< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
Matrix3D Cross(const Vec3D &A, const Matrix3D &B)
Definition: Matrix.h:198
Vec3D P1
Position of first contact point.
Mdouble P1_P2_Dissipation
not yet working
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
Mdouble P1_P2_distance
Length of contact line.
Defines a pair of periodic walls. The particles are in {x: position_left<=normal*x
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
void shift_positions(Vec3D &PI, Vec3D &PJ)
shifts two particles
void evaluate_force_statistics(int wp=0)
get force statistics
Mdouble distance(BaseParticle &P)
Returns the distance of the wall to the particle, and sets left_wall = true, if the left wall is the ...
double Mdouble
Definition: ExtendedMath.h:33
Vec3D P1_P2_normal
Direction of contact.
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
Mdouble Y
Definition: Vector.h:44
MatrixSymmetric3D P1_P2_Fabric
Fabric.
Matrix3D P1_P2_NormalStress
Contact stress from normal forces along the line of contact.
Vec3D P1_P2_CollisionalHeatFlux
not yet working
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
Matrix3D P1_P2_ContactCoupleStress
BoundaryHandler & getBoundaryHandler()
Definition: MD.h:149
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble P1_P2_Potential
not yet working
Mdouble Z
Definition: Vector.h:44
Matrix3D P1_P2_TangentialStress
Contact stress from tangential forces along the line of contact.
template<StatType T>
void StatisticsVector< T >::evaluate_particle_statistics ( std::vector< BaseParticle * >::iterator  P,
int  wp = 0 
)

Calculates statistics for a single Particle.

Todo:
{I currently disabled displacement calculation as it takes forever}

Definition at line 1851 of file StatisticsVector.hcc.

References Cross(), PeriodicBoundary::distance(), Dyadic(), MD::get_t(), PeriodicBoundary::shift_position(), sqr, SymmetrizedDyadic(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

1851  {
1853  bool doDisplacement = false;
1854 
1855  if (periodicWalls)
1856  for (unsigned int k=wp; k<getBoundaryHandler().getNumberOfObjects(); k++)
1857  {
1859  if(b0)
1860  {
1861  Mdouble dist = b0->distance(P1);
1862  if (sqr(dist-(*P)->get_Radius())<9.0*get_w2())
1863  {
1864  b0->shift_position(*P);
1866  b0->shift_position(*P);
1867  }
1868  }
1869  }
1870 
1871  //evaluate fields that only depend on CParticle parameters
1872  Mdouble phi; //Course graining function
1873  Vec3D V = Vec3D(0,0,0);
1874  if (VelocityProfile.size()) V = getVelocityProfile ((*P)->get_Position());
1875 
1876  for (unsigned int i=0; i<Points.size(); i++) {
1877  phi = Points[i].CG_function((*P)->get_Position());
1878  if (phi) {
1879  if (!std::isfinite(phi)) {
1880  std::cout
1881  << "t =" << MD::get_t()
1882  << "error: phi =" << phi
1883  << " is infinite for P=" << (*P)->get_Position()
1884  << ", Point=" << Points[i].get_Position()
1885  << std::endl;
1886  phi=0;
1887  }
1888  Points[i].Nu += (*P)->get_Volume(get_Species()) * phi;
1889  Points[i].Density += (*P)->get_Mass() * phi;
1890  if (VelocityProfile.size()) {
1891  Points[i].Momentum += ((*P)->get_Velocity()-V) * ((*P)->get_Mass() * phi);
1892  Points[i].MomentumFlux += SymmetrizedDyadic((*P)->get_Velocity()-V, (*P)->get_Velocity()-V) * ((*P)->get_Mass() * phi);
1893  } else {
1894  Points[i].Momentum += (*P)->get_Velocity() * ((*P)->get_Mass() * phi);
1895  Points[i].MomentumFlux += SymmetrizedDyadic((*P)->get_Velocity(), (*P)->get_Velocity()) * ((*P)->get_Mass() * phi);
1896  }
1897  Points[i].DisplacementMomentum += (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) * ((*P)->get_Mass() * phi);
1898  Points[i].DisplacementMomentumFlux += SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount())) * ((*P)->get_Mass() * phi);
1899  Points[i].EnergyFlux += (*P)->get_Velocity() * ((*P)->get_Mass()*(*P)->get_Velocity().GetLength2()/2 * phi);
1900 
1901  Vec3D LocalAngularMomentum = Cross(Points[0].clearAveragedDirections((*P)->get_Position()-Points[i].get_Position()), (*P)->get_Velocity()) * (*P)->get_Mass()
1902  + (*P)->get_AngularVelocity() * (*P)->get_Inertia();
1903  Points[i].LocalAngularMomentum += phi * LocalAngularMomentum;
1904  Points[i].LocalAngularMomentumFlux += Dyadic(LocalAngularMomentum, (*P)->get_Velocity() * phi);
1905 
1906  //Note: Displacement is only computed directly if gradients are cmputed
1907  if (get_doGradient()) {
1908 
1909  Vec3D d_phi = Points[i].CG_gradient((*P)->get_Position(), phi);
1910 
1911  if (doDisplacement) {
1912  //begin: Linear displacement, \f$1/(2 \rho^2) \sum_{pq} m_p m_q \phi_q *(v_{pqa} \partial_b \phi_p + v_{pqb} \partial_a \phi_p) \f$
1913  for (std::vector<BaseParticle*>::iterator Q = getParticleHandler().begin(); Q!=getParticleHandler().end(); ++Q) {
1914  double phiQ = Points[i].CG_function((*Q)->get_Position()); //Course graining function
1915  Points[i].Displacement += SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) - (*Q)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), d_phi)
1916  * ((*P)->get_Mass() * (*Q)->get_Mass() * phiQ);
1917  }
1918  //end:Displacement
1919  }
1920 
1921  dx[i].Nu += (*P)->get_Volume(get_Species()) * d_phi.X;
1922  dx[i].Density += (*P)->get_Mass() * d_phi.X;
1923  dx[i].Momentum += (*P)->get_Velocity() * ((*P)->get_Mass() * d_phi.X);
1924  dx[i].DisplacementMomentum += (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) * ((*P)->get_Mass() * d_phi.X);
1925  dx[i].MomentumFlux += SymmetrizedDyadic((*P)->get_Velocity(), (*P)->get_Velocity()) * ((*P)->get_Mass() * d_phi.X);
1926  dx[i].DisplacementMomentumFlux += SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount())) * ((*P)->get_Mass() * d_phi.X);
1927  dx[i].EnergyFlux += (*P)->get_Velocity() * ((*P)->get_Mass()*(*P)->get_Velocity().GetLength2()/2 * d_phi.X);
1928 
1929  dy[i].Nu += (*P)->get_Volume(get_Species()) * d_phi.Y;
1930  dy[i].Density += (*P)->get_Mass() * d_phi.Y;
1931  dy[i].Momentum += (*P)->get_Velocity() * ((*P)->get_Mass() * d_phi.Y);
1932  dy[i].DisplacementMomentum += (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) * ((*P)->get_Mass() * d_phi.Y);
1933  dy[i].MomentumFlux += SymmetrizedDyadic((*P)->get_Velocity(), (*P)->get_Velocity()) * ((*P)->get_Mass() * d_phi.Y);
1934  dy[i].DisplacementMomentumFlux += SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount())) * ((*P)->get_Mass() * d_phi.Y);
1935  dy[i].EnergyFlux += (*P)->get_Velocity() * ((*P)->get_Mass()*(*P)->get_Velocity().GetLength2()/2 * d_phi.Y);
1936 
1937  dz[i].Nu += (*P)->get_Volume(get_Species()) * d_phi.Z;
1938  dz[i].Density += (*P)->get_Mass() * d_phi.Z;
1939  dz[i].Momentum += (*P)->get_Velocity() * ((*P)->get_Mass() * d_phi.Z);
1940  dz[i].DisplacementMomentum += (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) * ((*P)->get_Mass() * d_phi.Z);
1941  dz[i].MomentumFlux += SymmetrizedDyadic((*P)->get_Velocity(), (*P)->get_Velocity()) * ((*P)->get_Mass() * d_phi.Z);
1942  dz[i].DisplacementMomentumFlux += SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount())) * ((*P)->get_Mass() * d_phi.Z);
1943  dz[i].EnergyFlux += (*P)->get_Velocity() * ((*P)->get_Mass()*(*P)->get_Velocity().GetLength2()/2 * d_phi.Z);
1944  } //end if get_doGradient
1945  } //end if phi
1946  } // end forall Points
1947 }
std::vector< CSpecies > & get_Species(void)
Allows the species to be copied.
Definition: MD.h:126
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
Mdouble get_zmin()
Gets zmin.
Definition: MD.h:313
Mdouble X
Definition: Vector.h:44
int get_savecount()
Allows the number of time steps between saves to be accessed.
Definition: MD.h:162
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
std::vector< Vec3D > VelocityProfile
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
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< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
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
Matrix3D Cross(const Vec3D &A, const Matrix3D &B)
Definition: Matrix.h:198
#define sqr(a)
Definition: ExtendedMath.h:36
Vec3D P1
Position of first contact point.
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
Mdouble get_ymax()
Gets ymax.
Definition: MD.h:311
Defines a pair of periodic walls. The particles are in {x: position_left<=normal*x
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
Mdouble get_ymin()
Gets ymin.
Definition: MD.h:309
Mdouble distance(BaseParticle &P)
Returns the distance of the wall to the particle, and sets left_wall = true, if the left wall is the ...
MatrixSymmetric3D SymmetrizedDyadic(Vec3D A, Vec3D B)
calculates the symmetrized dyadic product ( )
Mdouble get_xmin()
Get xmin.
Definition: MD.h:305
double Mdouble
Definition: ExtendedMath.h:33
Vec3D getVelocityProfile(Vec3D Position)
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
Matrix3D Dyadic(Vec3D A, Vec3D B)
calculates the dyadic product ( )
Definition: Matrix.h:191
void evaluate_particle_statistics(std::vector< BaseParticle * >::iterator P, int wp=0)
Calculates statistics for a single Particle.
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
Mdouble Y
Definition: Vector.h:44
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
BoundaryHandler & getBoundaryHandler()
Definition: MD.h:149
ParticleHandler & getParticleHandler()
Definition: MD.h:147
Mdouble get_xmax()
Get xmax.
Definition: MD.h:307
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble Z
Definition: Vector.h:44
Mdouble get_zmax()
Gets zmax.
Definition: MD.h:315
template<StatType T>
void StatisticsVector< T >::evaluate_wall_force_statistics ( Vec3D  P,
int  wp = 0 
)

get force statistics (i.e. first particle is a wall particle)

todo{Whate are P1 and P2 over here?}

Todo:
this has recently been fixed

Definition at line 1787 of file StatisticsVector.hcc.

References PeriodicBoundary::distance(), PeriodicBoundary::shift_positions(), Vec3D::X, Vec3D::Y, and Vec3D::Z.

1788 {
1790  if(periodicWalls)
1791  for (unsigned int k=wp; k<getBoundaryHandler().getNumberOfObjects(); k++)
1792  {
1794  if(b0)
1795  {
1796  b0->distance(P1);
1797  b0->shift_positions(P1,P2);
1799  b0->shift_positions(P1,P2);
1800  }
1801  }
1802 
1803  //evaluate fields that only depend on CParticle parameters
1804  Mdouble phi; //Course graining integral
1805  for (unsigned int i=0; i<Points.size(); i++) {
1806  phi = Points[i].CG_function(P);
1807  if (phi) {
1808  Points[i].NormalTraction += P1_P2_NormalTraction * phi;
1809  Points[i].TangentialTraction += P1_P2_TangentialTraction * phi;
1810  if (get_doGradient()) {
1812  Vec3D d_phi = Points[i].CG_gradient(P, phi);
1813  dx[i].NormalTraction += P1_P2_NormalTraction * d_phi.X;
1814  dy[i].NormalTraction += P1_P2_NormalTraction * d_phi.Y;
1815  dz[i].NormalTraction += P1_P2_NormalTraction * d_phi.Z;
1816  dx[i].TangentialTraction += P1_P2_TangentialTraction * d_phi.X;
1817  dy[i].TangentialTraction += P1_P2_TangentialTraction * d_phi.Y;
1818  dz[i].TangentialTraction += P1_P2_TangentialTraction * d_phi.Z;
1819  } //end if get_doGradient
1820  } //end if phi
1821  } // end forall Points
1822 
1823 }
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
Mdouble X
Definition: Vector.h:44
Vec3D P2
Position of second contact point.
Vec3D P1_P2_TangentialTraction
Traction from tangential forces at contact of flow with fixed particles or walls. ...
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
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< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
Vec3D P1
Position of first contact point.
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
Defines a pair of periodic walls. The particles are in {x: position_left<=normal*x
void shift_positions(Vec3D &PI, Vec3D &PJ)
shifts two particles
void evaluate_force_statistics(int wp=0)
get force statistics
Mdouble distance(BaseParticle &P)
Returns the distance of the wall to the particle, and sets left_wall = true, if the left wall is the ...
double Mdouble
Definition: ExtendedMath.h:33
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
Mdouble Y
Definition: Vector.h:44
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
BoundaryHandler & getBoundaryHandler()
Definition: MD.h:149
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble Z
Definition: Vector.h:44
Vec3D P1_P2_NormalTraction
Traction from normal forces at contact of flow with fixed particles or walls.
template<StatType T>
Mdouble StatisticsVector< T >::evaluateIntegral ( Mdouble  n1,
Mdouble  n2,
Mdouble  t 
)
inline

Definition at line 252 of file StatisticsVector.h.

References StatisticsVector< T >::CGPolynomial.

252  {
253  return CGPolynomial.evaluateIntegral(n1,n2,t);
254  }
Mdouble t
This stores the current time.
Definition: MD.h:687
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
template<StatType T>
Mdouble StatisticsVector< T >::evaluatePolynomial ( Mdouble  r)
inline

Definition at line 244 of file StatisticsVector.h.

References StatisticsVector< T >::CGPolynomial.

244  {
245  return CGPolynomial.evaluate(r);
246  }
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
template<StatType T>
Mdouble StatisticsVector< T >::evaluatePolynomialGradient ( Mdouble  r)
inline

Definition at line 248 of file StatisticsVector.h.

References StatisticsVector< T >::CGPolynomial.

248  {
249  return CGPolynomial.evaluateGradient(r);
250  }
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
template<StatType T>
void StatisticsVector< T >::finish_statistics ( )
virtual

Finish all statistics (i.e. write out final data)

Reimplemented from MD.

Definition at line 729 of file StatisticsVector.hcc.

730 {
732  stat_file.close();
733 }
std::fstream stat_file
Definition: STD_save.h:253
void write_time_average_statistics()
Writes out time averaged statistics.
template<StatType T>
void StatisticsVector< T >::gather_force_statistics_from_fstat_and_data ( )

get force statistics from particle collisions

Todo:
{fstat misses torque; any new implementation of storing forces should also store the torque}

Definition at line 1662 of file StatisticsVector.hcc.

1663 {
1664  //read in first three lines (should start with '#')
1665  std::string dummy;
1666  if (get_options_fstat()==2) increase_counter_fstat(std::fstream::in);
1667  getline (get_fstat_file(), dummy);
1668  getline (get_fstat_file(), dummy);
1669  getline (get_fstat_file(), dummy);
1670 
1671 
1672  static Mdouble time;
1673  static int index1, index2;
1674  static Vec3D Contact;
1675  static Mdouble delta, ctheta, fdotn, fdott;
1676  static Vec3D P1_P2_normal_, P1_P2_tangential;
1677  static BaseParticle PI;
1678  static BaseParticle PJ;
1679 
1680  int counter = 0;
1681  //go through each line in the fstat file; break when eof or '#' or newline
1682  while ( (get_fstat_file().peek() != -1) && (get_fstat_file().peek() != '#') ) { //(!get_fstat_file().eof())
1683  counter++;
1684  /* # 1: time
1685  # 2: particle Number i
1686  # 3: contact partner j (particles >= 0, walls < 0)
1687  # 4: x-position \
1688  # 5: y-position > of the contact point (I hope)
1689  # 6: z-position /
1690  # 7: delta = overlap at the contact
1691  # 8: ctheta = length of the tangential spring
1692  # 9: P1_P2_normal force |f^n|
1693  # 10: remaining (tangential) force |f^t|=|f-f^n|
1694  # 11-13: P1_P2_normal unit vector nx, ny, nz
1695  # 14-16: tangential unit vector tx, ty, tz
1696  */
1697  get_fstat_file()
1698  >> time
1699  >> index1
1700  >> index2
1701  >> Contact
1702  >> delta
1703  >> ctheta
1704  >> fdotn
1705  >> fdott
1706  >> P1_P2_normal_
1707  >> P1_P2_tangential;
1709  get_fstat_file().ignore(256,'\n');
1710  //Finished reading fstat file
1711  gather_statistics_collision(index1,index2,Contact,delta,ctheta,fdotn,fdott, P1_P2_normal_, P1_P2_tangential);
1712 
1713  }
1714  if (verbosity>1) std::cout << "#forces="<< counter << std::endl;
1715 }
int counter
The stores the run number for saving.
Definition: STD_save.h:238
unsigned int get_options_fstat(void)
Definition: STD_save.h:159
double Mdouble
Definition: ExtendedMath.h:33
bool increase_counter_fstat(std::fstream::openmode mode)
Definition: STD_save.h:217
std::fstream & get_fstat_file()
Allows the problem_name to be accessed.
Definition: STD_save.h:134
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
void gather_statistics_collision(int index1, int index2, Vec3D Contact, Mdouble delta, Mdouble ctheta, Mdouble fdotn, Mdouble fdott, Vec3D P1_P2_normal_, Vec3D P1_P2_tangential)
Calculates statistics for one collision (can be any kind of collision)
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
template<StatType T>
void StatisticsVector< T >::gather_force_statistics_from_p3c ( int  version)

get force statistics from particle collisions

Todo:
This has to be tested

Definition at line 1172 of file StatisticsVector.hcc.

References BaseParticle::get_Position(), and BaseParticle::get_Radius().

1173 {
1174  std::string dummyStr;
1175  Mdouble N, dummy;
1176 
1177  //Ignoring first line
1178  getline(p3c_file, dummyStr);
1179  std::cout << dummyStr << std::endl;
1180  //Reading second line
1181  p3c_file >> dummy; set_t(dummy);
1182  p3c_file >> N;
1183  std::cout << "t= " << get_t() << ": loading " << N << " contacts ..." << std::endl;
1184  getline(p3c_file,dummyStr);
1185  //Ignoring third line
1186  getline(p3c_file,dummyStr);
1187  std::cout << dummyStr << std::endl;
1188  //Checking for end of file
1189  //if (p3c_file.eof()||p3c_file.peek()==-1) return false;
1190 
1191  //set up index list
1192  int Nmax = 0;
1193  for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it)
1194  Nmax = std::max(Nmax,(*it)->get_Index());
1195  static std::vector<int> index;
1196  index.resize(Nmax);
1197  int i=0;
1198  for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
1199  index[(*it)->get_Index()]=i;
1200  i++;
1201  }
1202 
1203  // ==> Particledata_4.2to4.25s.csv.p4c <==
1204  // TIMESTEP CONTACTS
1205  // 4.2001 31367
1206  // P1 P2 CX CY CZ FX FY FZ
1207  // 9711 9424 0.0549396 0.009705380.149582 4.37283e-05 2.02347e-05 -0.000250662
1208 
1209  // ==> /Users/weinhartt/CarlosLabra/ConfinedCompression_P3P_Spheres.csv.p3c <==
1210  // TIMESTEP CONTACTS
1211  // 6.500010000000e-01 21886
1212  // P1 P2 FX FY FZ
1213  // 1126 218 -1.899612000000e-02 6.716474700000e-02 -1.527340000000e-02
1214 
1215  int index1_p3, index2_p3;
1216  int index1, index2;
1217  Vec3D Contact, Force;
1218  Mdouble delta, fdotn, fdott;
1219  Vec3D P1_P2_normal, P1_P2_tangential;
1220  Mdouble dist;
1221  BaseParticle* P1;
1222  BaseParticle* P2;
1223 
1224  Vec3D contact;
1225  int counter = 0;
1226  //go through N lines in the p4c file
1227  for (int i=0; i<N; i++) {
1228  counter++;
1229  if (version==3) {
1230  p3c_file
1231  >> index1_p3
1232  >> index2_p3
1233  >> Force;
1234  } else {
1235  p3c_file
1236  >> index1_p3
1237  >> index2_p3
1238  >> Contact
1239  >> Force;
1240  }
1241  index1=index[index1_p3];
1242  index2=index[index2_p3];
1243  P1 = getParticleHandler().getObject(index1);
1244  P2 = getParticleHandler().getObject(index2);
1245  P1_P2_normal = P1->get_Position() - P2->get_Position();
1246  dist = GetLength(P1_P2_normal);
1247  P1_P2_normal /= dist;
1248  delta = P1->get_Radius() + P2->get_Radius() - dist;
1249  if (version==3) {
1250  Contact = P2->get_Position() + P1_P2_normal * (P2->get_Radius()-delta/2);
1251  }
1252  fdotn = -Dot(Force,P1_P2_normal)/GetLength2(P1_P2_normal);
1253  P1_P2_tangential = Force + fdotn * P1_P2_normal; //get tangential force
1254  fdott = GetLength(P1_P2_tangential);
1255  if (fdott==0) {
1256  P1_P2_tangential = Vec3D(0,0,0);
1257  } else {
1258  P1_P2_tangential /= fdott;
1259  }
1260  //Finished reading file
1261  gather_statistics_collision(index1,index2,Contact,delta,0,fdotn,fdott, P1_P2_normal,-P1_P2_tangential);
1262  gather_statistics_collision(index2,index1,Contact,delta,0,fdotn,fdott, -P1_P2_normal, P1_P2_tangential);
1263  }
1264 
1265 
1266  if (verbosity>1) std::cout << "#forces="<< counter << std::endl;
1267  //Ignoring last line
1268  getline(p3c_file,dummyStr);
1269  std::cout << dummyStr << std::endl;
1270 
1271  gather_force_statistics_from_p3w(version,index);
1272 }
Vec3D P2
Position of second contact point.
int counter
The stores the run number for saving.
Definition: STD_save.h:238
void gather_force_statistics_from_p3w(int version, std::vector< int > &index)
get force statistics from particle collisions
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
Vec3D P1
Position of first contact point.
void set_t(Mdouble new_t)
Access function for the time.
Definition: MD.h:110
Mdouble get_Radius() const
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
Vec3D P1_P2_normal
Direction of contact.
const Vec3D & get_Position() const
std::fstream p3c_file
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
void gather_statistics_collision(int index1, int index2, Vec3D Contact, Mdouble delta, Mdouble ctheta, Mdouble fdotn, Mdouble fdott, Vec3D P1_P2_normal_, Vec3D P1_P2_tangential)
Calculates statistics for one collision (can be any kind of collision)
ParticleHandler & getParticleHandler()
Definition: MD.h:147
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
template<StatType T>
void StatisticsVector< T >::gather_force_statistics_from_p3w ( int  version,
std::vector< int > &  index 
)

get force statistics from particle collisions

Todo:
This has to be tested

Definition at line 1276 of file StatisticsVector.hcc.

References BaseParticle::get_Position(), and BaseParticle::get_Radius().

1277 {
1278  std::string dummyStr;
1279  Mdouble N, dummy;
1280 
1281  //Ignoring first line
1282  getline(p3w_file, dummyStr);
1283  std::cout << dummyStr << std::endl;
1284  //Reading second line
1285  p3w_file >> dummy; set_t(dummy);
1286  p3w_file >> N;
1287  std::cout << "t= " << get_t() << ": loading " << N << " wall contacts ..." << std::endl;
1288  getline(p3w_file,dummyStr);
1289  //Ignoring third line
1290  getline(p3w_file,dummyStr);
1291  std::cout << dummyStr << std::endl;
1292 
1293  // ==> /Users/weinhartt/CarlosLabra/ConfinedCompression_P3P_Spheres.csv.p3w <==
1294  // TIMESTEP CONTACTS
1295  // 6.500010000000e-01 3778
1296  // P1 FX FY FZ NX NY NZ (N=Branch)
1297  // 671 0.000000000000e+00 0.000000000000e+00 1.965970000000e-01 0.000000000000e+00 0.000000000000e+00 -1.991510000000e-03
1298  // ==> Particledata_4.2to4.25s.csv.p4w <==
1299  // TIMESTEP CONTACTS
1300  // 4.2001 5770
1301  // P1 CX CY CZ FX FY FZ
1302  // 10590 0.00944221 0.0120.130307 -3.14611e-06 -0.000512936 0.000102539
1303  // 10146 0.0615829 00.162907 2.02968e-05 0.000948522 0.000188616
1304 
1305  int index1_p3;
1306  int index1, index2;
1307  Vec3D Contact, Force, Branch;
1308  Mdouble delta, fdotn, fdott;
1309  Vec3D P1_P2_normal, P1_P2_tangential;
1310  Mdouble dist;
1311  BaseParticle* P1;
1312 
1313  Vec3D contact;
1314  int counter = 0;
1315  //go through each line in the fstat file; break when eof or '#' or newline
1316  for (int i=0; i<N; i++) {
1317  counter++;
1318  if (version==3) {
1319  p3w_file
1320  >> index1_p3
1321  >> Force
1322  >> Branch;
1323  } else {
1324  p3w_file
1325  >> index1_p3
1326  >> Contact
1327  >> Force;
1328  }
1329  index1=index[index1_p3];
1330  index2=-1;
1331  P1 = getParticleHandler().getObject(index1);
1332  if (version==3) {
1333  //Branch *= -1;
1334  Contact = P1->get_Position() + Branch;
1335  } else {
1336  Branch = Contact - P1->get_Position();
1337  }
1338  dist = GetLength(Branch);
1339  P1_P2_normal = Branch / dist;
1340  delta = P1->get_Radius() - dist; //check
1341  fdotn = -Dot(Force,P1_P2_normal)/GetLength2(P1_P2_normal);
1342  P1_P2_tangential = Force + fdotn * P1_P2_normal; //get tangential force
1343  fdott = GetLength(P1_P2_tangential);
1344  if (fdott==0) {
1345  P1_P2_tangential = Vec3D(0,0,0);
1346  } else {
1347  P1_P2_tangential /= fdott;
1348  }
1349  //Finished reading fstat file
1350  gather_statistics_collision(index1,index2,Contact,delta,0,fdotn,fdott, P1_P2_normal, -P1_P2_tangential);
1351  }
1352 
1353  if (verbosity>1) std::cout << "#wall forces="<< counter << std::endl;
1354  //Ignoring last line
1355  getline(p3w_file,dummyStr);
1356  std::cout << dummyStr << std::endl;
1357 }
int counter
The stores the run number for saving.
Definition: STD_save.h:238
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
Vec3D P1
Position of first contact point.
std::fstream p3w_file
void set_t(Mdouble new_t)
Access function for the time.
Definition: MD.h:110
Mdouble get_Radius() const
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
double Mdouble
Definition: ExtendedMath.h:33
Vec3D P1_P2_normal
Direction of contact.
const Vec3D & get_Position() const
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
void gather_statistics_collision(int index1, int index2, Vec3D Contact, Mdouble delta, Mdouble ctheta, Mdouble fdotn, Mdouble fdott, Vec3D P1_P2_normal_, Vec3D P1_P2_tangential)
Calculates statistics for one collision (can be any kind of collision)
ParticleHandler & getParticleHandler()
Definition: MD.h:147
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
template<StatType T>
void StatisticsVector< T >::gather_statistics_collision ( int index1  ,
int index2  ,
Vec3D Contact  ,
Mdouble delta  ,
Mdouble ctheta  ,
Mdouble fdotn  ,
Mdouble fdott  ,
Vec3D P1_P2_normal_  ,
Vec3D P1_P2_tangential   
)
virtual

Calculates statistics for one collision (can be any kind of collision)

Todo:
: this is to make the stresses infinitely (i.e. 300 units) long; has to be improved such that it always extends to z->inf

2012Nov28TW I changed this from P1 to P2; was this mistake always there?

Todo:
this is to make the stresses infinitely (i.e. 300 units) long
Todo:
{this only works for StatType Z}

this is because wall-particle collisions appear only once in fstat

Todo:
{I, Thomas, removed the effect on different particle sizes bc it gave wrong results in the stress balance; why is this here?}
Todo:
{fabric should be divided by N}
Todo:
{Fabric definition only works for monodispersed particles, i.e. C=(F_xx+F_yy+F_zz)/nu only for monodispersed particles}

Note P1_P2 distance and normal are still in 3D, even for averages

Todo:
check this is not killing the Heaviside CG function. If it is donot use the Heaviside function, the simple solution.

todo{Difference here between direct and indirect statistics}

Reimplemented from MD.

Definition at line 1518 of file StatisticsVector.hcc.

References Dyadic(), sqr, SymmetrizedDyadic(), and Vec3D::Z.

1519 {
1520  Vec3D P1_P2_VelocityAverage, P1_P2_VelocityDifference, P1_P2_Force;
1521  Mdouble norm_dist;
1523  {
1524  //make sure that for a particle-fixed particle collision the fixed particle is on index2 (switch particles if needed)
1525  if (getParticleHandler().getObject(index1)->isFixed()) {
1526  int tmp = index1; index1 = index2; index2 = tmp;
1527  P1_P2_normal_*=-1;
1528  }
1529 
1530  if (satisfiesInclusionCriteria(getParticleHandler().getObject(index1)))
1531  {
1532  P1_P2_normal=P1_P2_normal_;
1533 
1534  if (get_dim()==2) Contact.Z = 0.0;
1535 
1536  if (index2<0)
1537  { //wall-particle collision
1539  P2 = Contact;
1540  P1 = Contact-P1_P2_normal*P1_P2_distance; //note, here we use a minus
1541  norm_dist=P1_P2_distance;
1542  P1_P2_VelocityAverage = (getParticleHandler().getObject(index1)->get_Velocity())/2;
1543  P1_P2_VelocityDifference = (getParticleHandler().getObject(index1)->get_Velocity());
1544 
1545  if (StressTypeForFixedParticles==3) {
1547  P1_P2_distance += 300;
1549  P2 += 300*P1_P2_normal;
1550  //this is because wall-particle collisions appear only once in fstat
1551  norm_dist=P1_P2_distance;
1552  }
1553  }
1554  else if (getParticleHandler().getObject(index2)->isFixed()||!satisfiesInclusionCriteria(getParticleHandler().getObject(index2)))
1555  { //particle-fixed particle collision (external force acts at contact point)
1557  //infinite extension of stress
1558  P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()+getParticleHandler().getObject(index2)->get_Radius()-delta;
1559  P1 = Contact+P1_P2_normal*(0.5*P1_P2_distance); //flowing particle
1560  P2 = Contact-P1_P2_normal*(0.5*P1_P2_distance); //fixed particle
1561  if (P1_P2_normal.Z<0) { //in this case revert flowing and fixed particle
1562  //std::cerr << "Warning: Force normal upwards on base z=" << P1.Z << "." << P2.Z << std::endl;
1563  //turning force the other way to achieve sigma=0 at z=inf
1564  P1_P2_normal*=-1.0;
1565  fdotn *=-1.0;
1566  }
1568  P1_P2_distance=setInfinitelyLongDistance();
1570  P2 = P1 - P1_P2_normal*P1_P2_distance; //move endpoint of force line downwards beyond fixed particles out of the domain
1571  if (P1_P2_normal.Z<0) std::cout << P1_P2_distance << " z" << P1.Z << " " << P2.Z << " f" << fdotn << std::endl;
1573  } else if (StressTypeForFixedParticles==1|| (!getParticleHandler().getObject(index2)->isFixed()&&StressTypeForFixedParticles==3)) {
1574  //add force from flowing particle to contact point to stress
1575  P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()+getParticleHandler().getObject(index2)->get_Radius()-delta;
1576  P1 = Contact+P1_P2_normal*(0.5*P1_P2_distance); //1st particle
1577  //P2 = Contact; //Contact point;
1578  //P1_P2_distance /= 2.0;
1579  P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()-delta/2; //Contact point;
1580  P2 = P1 - P1_P2_normal*P1_P2_distance; //Contact point (corrected for polydispersed particles);
1581  } else {
1582  //add force from flowing particle to fixed particle to stress
1583  P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()+getParticleHandler().getObject(index2)->get_Radius()-delta;
1584  P1 = Contact+P1_P2_normal*(0.5*P1_P2_distance);
1585  P2 = Contact-P1_P2_normal*(0.5*P1_P2_distance);
1586  }
1588  norm_dist=P1_P2_distance;//*2.0*Particles[index1].Radius/(Particles[index2].Radius+Particles[index1].Radius);
1589  //This is the length of the contact in particle 1.
1590  P1_P2_VelocityAverage = getParticleHandler().getObject(index2)->get_Velocity()/2;
1591  P1_P2_VelocityDifference = -getParticleHandler().getObject(index2)->get_Velocity();
1592  }
1593  else
1594  {//particle-particle collision
1595 
1596  if (getParticleHandler().getObject(index2)->isFixed()) std::cout << "ERROR" << std::endl;
1597  P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()+getParticleHandler().getObject(index2)->get_Radius()-delta;
1598 
1599  P1 = Contact+P1_P2_normal*(0.5*P1_P2_distance);
1600  P2 = Contact-P1_P2_normal*(0.5*P1_P2_distance);
1601  //This is the length of the contact in particle 1.
1602  norm_dist=P1_P2_distance*getParticleHandler().getObject(index1)->get_Radius()/(getParticleHandler().getObject(index2)->get_Radius()+getParticleHandler().getObject(index1)->get_Radius());
1603  P1_P2_VelocityAverage = (getParticleHandler().getObject(index1)->get_Velocity()+getParticleHandler().getObject(index2)->get_Velocity())/2;
1604  P1_P2_VelocityDifference = (getParticleHandler().getObject(index1)->get_Velocity()-getParticleHandler().getObject(index2)->get_Velocity());
1605  }
1607  //Particles[max(index1,index2)] is chosen so that it is the non-wall, non-fixed particle
1610  //fix
1611  //~ P1_P2_Fabric = SymmetrizedDyadic(P1_P2_normal, P1_P2_normal) * getParticleHandler().getObject(max(index1,index2))->get_Volume(get_Species());
1613  P1_P2_NormalStress = Dyadic(P1_P2_normal,P1_P2_normal) * (fdotn*norm_dist);
1614  P1_P2_TangentialStress = Dyadic(P1_P2_tangential,P1_P2_normal) * (fdott*norm_dist);
1616  P1_P2_TangentialTraction = P1_P2_tangential * fdott;
1618  P1_P2_Contact = Contact;
1619  P1_P2_Potential = (get_k()*sqr(delta)+get_kt()*sqr(ctheta))/2;
1620  P1_P2_Force = fdotn*P1_P2_normal+fdott*P1_P2_tangential;
1621  P1_P2_Dissipation = Dot(P1_P2_VelocityDifference,P1_P2_Force)/2;
1622  P1_P2_CollisionalHeatFlux = P1_P2_normal * (P1_P2_distance/2 * Dot(P1_P2_VelocityAverage,fdotn*P1_P2_normal+fdott*P1_P2_tangential)) + P1_P2_Potential * P1_P2_VelocityAverage;
1623  //Now P1_P2 distance and normal are in non-averaged directions - This is the projection of the distance on to the CG directions. Required for the later statistics hence done now, not before.
1624  P1_P2_distance *= sqrt(Points[0].dot(P1_P2_normal,P1_P2_normal));
1625 
1626  //If the normal to the contact and the averaging direction are EXACTLY+- parallel then set the normal to zero. Otherwise you would end up with nan, which is not good.
1628  if (P1_P2_distance>1e-12)
1629  P1_P2_normal = (P1-P2)/P1_P2_distance;
1630  else
1631  P1_P2_normal = Vec3D(0.0,0.0,0.0);
1632  //P1_P2_normal = (P1-P2)/P1_P2_distance;
1633 
1634  //if 2nd particle is wall, fixed particle or not-included particle
1635  if (index2<0 || getParticleHandler().getObject(index2)->isFixed() || !satisfiesInclusionCriteria(getParticleHandler().getObject(index2)))
1636  {
1637  // << "/" << P2 << std::endl;
1639  if (StressTypeForFixedParticles!=0) { //only if wall - flow contact adds anything to the stress
1641  }
1642  if (StressTypeForFixedParticles!=3 || !(index2<0 || getParticleHandler().getObject(index2)->isFixed())) { //only if stress is not infinitely extended
1643  Vec3D P;
1644  if (StressTypeForFixedParticles==0) {
1645  P=P1; //Traction at flow particle
1646  } else {
1647  P=P2; //Traction at contact point, resp wall particle
1648  }
1650  }
1651  }
1652  else
1653  {
1655  }
1656  }
1657  }
1658 }
std::vector< CSpecies > & get_Species(void)
Allows the species to be copied.
Definition: MD.h:126
Vec3D P2
Position of second contact point.
bool check_current_time_for_statistics()
Vec3D P1_P2_TangentialTraction
Traction from tangential forces at contact of flow with fixed particles or walls. ...
const Vec3D & get_Velocity() const
bool satisfiesInclusionCriteria(BaseParticle *P)
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
#define sqr(a)
Definition: ExtendedMath.h:36
Vec3D P1
Position of first contact point.
Mdouble P1_P2_Dissipation
not yet working
int get_dim()
Allows the dimension of the simulation to be accessed.
Definition: MD.h:369
Mdouble P1_P2_distance
Length of contact line.
void evaluate_wall_force_statistics(Vec3D P, int wp=0)
get force statistics (i.e. first particle is a wall particle)
bool isFixed()
Is fixed Particle function. It returns wether a Particle is fixed or not, by cheking its inverse Mass...
Mdouble get_Radius() const
void evaluate_force_statistics(int wp=0)
get force statistics
MatrixSymmetric3D SymmetrizedDyadic(Vec3D A, Vec3D B)
calculates the symmetrized dyadic product ( )
double Mdouble
Definition: ExtendedMath.h:33
Mdouble get_k(int indSpecies=0)
Allows the spring constant to be accessed.
Definition: MD.h:206
Matrix3D Dyadic(Vec3D A, Vec3D B)
calculates the dyadic product ( )
Definition: Matrix.h:191
Mdouble get_kt(int indSpecies=0)
Allows the spring constant to be accessed.
Definition: MD.h:210
Vec3D P1_P2_normal
Direction of contact.
MatrixSymmetric3D P1_P2_Fabric
Fabric.
Matrix3D P1_P2_NormalStress
Contact stress from normal forces along the line of contact.
Vec3D P1_P2_CollisionalHeatFlux
not yet working
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
Mdouble get_Volume(std::vector< CSpecies > &Species) const
Get Particle volume function, which required a reference to the Species vector. It returns the volume...
Matrix3D P1_P2_ContactCoupleStress
ParticleHandler & getParticleHandler()
Definition: MD.h:147
Mdouble setInfinitelyLongDistance()
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
Mdouble P1_P2_Potential
not yet working
Mdouble Z
Definition: Vector.h:44
Matrix3D P1_P2_TangentialStress
Contact stress from tangential forces along the line of contact.
Vec3D P1_P2_NormalTraction
Traction from normal forces at contact of flow with fixed particles or walls.
template<StatType T>
CG StatisticsVector< T >::get_CG_type ( )
inline

Definition at line 95 of file StatisticsVector.h.

References StatisticsVector< T >::CG_type.

95 {return CG_type;};
CG CG_type
coarse graining type (Gaussian, Heaviside, Polynomial)
template<StatType T>
Mdouble StatisticsVector< T >::get_cutoff ( )
inline

Definition at line 108 of file StatisticsVector.h.

References StatisticsVector< T >::cutoff.

108 {return cutoff;};
Mdouble cutoff
The distance from the origin at which the cg function vanishes; cutoff=w for HeavisideSphere or Polyn...
template<StatType T>
Mdouble StatisticsVector< T >::get_cutoff2 ( )
inline

Definition at line 109 of file StatisticsVector.h.

References StatisticsVector< T >::cutoff, and sqr.

109 {return sqr(cutoff);};
Mdouble cutoff
The distance from the origin at which the cg function vanishes; cutoff=w for HeavisideSphere or Polyn...
#define sqr(a)
Definition: ExtendedMath.h:36
template<StatType T>
bool StatisticsVector< T >::get_doGradient ( )
inline

Definition at line 144 of file StatisticsVector.h.

References StatisticsVector< T >::doGradient.

144 {return doGradient;};
bool doGradient
Determines if gradient is outputted.
template<StatType T>
bool StatisticsVector< T >::get_doTimeAverage ( )
inline

Definition at line 129 of file StatisticsVector.h.

References StatisticsVector< T >::doTimeAverage.

129 {return doTimeAverage;};
bool doTimeAverage
Determines if output is averaged over time.
template<StatType T>
bool StatisticsVector< T >::get_doublePoints ( )
inline

Definition at line 234 of file StatisticsVector.h.

References StatisticsVector< T >::doublePoints.

234 {return doublePoints;}
template<StatType T>
bool StatisticsVector< T >::get_doVariance ( )
inline

Definition at line 141 of file StatisticsVector.h.

References StatisticsVector< T >::doVariance.

141 {return doVariance;};
bool doVariance
Determines if variance is outputted.
template<StatType T>
bool StatisticsVector< T >::get_ignoreFixedParticles ( )
inline

Definition at line 150 of file StatisticsVector.h.

References StatisticsVector< T >::ignoreFixedParticles.

150 {return ignoreFixedParticles;};
bool ignoreFixedParticles
Determines if fixed particles contribute to particle statistics (density, ...)
template<StatType T>
Mdouble StatisticsVector< T >::get_mirrorAtDomainBoundary ( )
inline

Definition at line 138 of file StatisticsVector.h.

References StatisticsVector< T >::mirrorAtDomainBoundary.

138 {return mirrorAtDomainBoundary;};
Mdouble mirrorAtDomainBoundary
template<StatType T>
void StatisticsVector< T >::get_n ( int nx_,
int ny_,
int nz_ 
)
inline

Definition at line 98 of file StatisticsVector.h.

References StatisticsVector< T >::nx, StatisticsVector< T >::ny, and StatisticsVector< T >::nz.

98 {nx_=nx; ny_=ny; nz_=nz;};
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
template<StatType T>
int StatisticsVector< T >::get_nTimeAverage ( )
inline

Definition at line 212 of file StatisticsVector.h.

References StatisticsVector< T >::nTimeAverage.

212 {return nTimeAverage;};
int nTimeAverage
A counter needed to average over time.
template<StatType T>
int StatisticsVector< T >::get_nx ( )
inline

Definition at line 82 of file StatisticsVector.h.

References StatisticsVector< T >::nx.

82 {return nx;};
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
template<StatType T>
int StatisticsVector< T >::get_ny ( )
inline

Definition at line 83 of file StatisticsVector.h.

References StatisticsVector< T >::ny.

83 {return ny;};
template<StatType T>
int StatisticsVector< T >::get_nz ( )
inline

Definition at line 84 of file StatisticsVector.h.

References StatisticsVector< T >::nz.

84 {return nz;};
template<StatType T>
bool StatisticsVector< T >::get_periodicWalls ( )
inline

Definition at line 160 of file StatisticsVector.h.

References StatisticsVector< T >::periodicWalls.

160 {return periodicWalls;};
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::get_Points ( )
inline

Definition at line 197 of file StatisticsVector.h.

References StatisticsVector< T >::Points.

197 {return Points;};
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
template<StatType T>
std::string StatisticsVector< T >::get_PolynomialName ( )
inline

Definition at line 228 of file StatisticsVector.h.

References StatisticsVector< T >::CGPolynomial.

228  {
229  return CGPolynomial.get_name();
230  }
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
template<StatType T>
int StatisticsVector< T >::get_StressTypeForFixedParticles ( )
inline

Definition at line 132 of file StatisticsVector.h.

References StatisticsVector< T >::StressTypeForFixedParticles.

int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
template<StatType T>
bool StatisticsVector< T >::get_superexact ( )
inline

Definition at line 147 of file StatisticsVector.h.

References StatisticsVector< T >::superexact.

147 {return superexact;};
bool superexact
If true, cutoff radius for Gaussian is set to 5*w (from 3*w)
template<StatType T>
bool StatisticsVector< T >::get_TimeAverageReset ( )
inline

Definition at line 238 of file StatisticsVector.h.

References StatisticsVector< T >::nTimeAverageReset.

238 {return nTimeAverageReset;}
int nTimeAverageReset
Determines after how many timesteps the time average is reset.
template<StatType T>
Mdouble StatisticsVector< T >::get_tintStat ( )
inline

Definition at line 90 of file StatisticsVector.h.

References StatisticsVector< T >::tintStat.

90 {return tintStat;};
Mdouble tintStat
Statistical output will only be created if tmaxStat-tintStat< t< tmaxStat.
template<StatType T>
Mdouble StatisticsVector< T >::get_tmaxStat ( )
inline

Definition at line 89 of file StatisticsVector.h.

References MD::get_tmax(), and StatisticsVector< T >::tmaxStat.

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

89 {if(std::isnan(tmaxStat)) return get_tmax(); else return tmaxStat;};
Mdouble tmaxStat
Statistical output will only be created if t
Mdouble get_tmax()
Allows the upper time limit to be accessed.
Definition: MD.h:144
template<StatType T>
Mdouble StatisticsVector< T >::get_tminStat ( )
inline

Definition at line 88 of file StatisticsVector.h.

References StatisticsVector< T >::tminStat.

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

88 {return tminStat;};
Mdouble tminStat
Statistical output will only be created if t>tminStat.
template<StatType T>
int StatisticsVector< T >::get_verbosity ( )
inline

Definition at line 154 of file StatisticsVector.h.

References StatisticsVector< T >::verbosity.

154 {return verbosity;};
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
template<StatType T>
Mdouble StatisticsVector< T >::get_w ( )
inline

Definition at line 106 of file StatisticsVector.h.

References StatisticsVector< T >::w2.

106 {return sqrt(w2);};
Mdouble w2
coarse graining width squared; for HeavisideSphere and Gaussian
template<StatType T>
Mdouble StatisticsVector< T >::get_w2 ( )
inline

Definition at line 107 of file StatisticsVector.h.

References StatisticsVector< T >::w2.

107 {return w2;};
Mdouble w2
coarse graining width squared; for HeavisideSphere and Gaussian
template<StatType T>
Mdouble StatisticsVector< T >::get_w_over_rmax ( )
inline

Definition at line 163 of file StatisticsVector.h.

References StatisticsVector< T >::w_over_rmax.

163 {return w_over_rmax;};
Mdouble w_over_rmax
if w is not set manually then w will be set by multiplying this value by the largest particle radius ...
template<StatType T>
bool StatisticsVector< T >::get_walls ( )
inline

Definition at line 157 of file StatisticsVector.h.

References StatisticsVector< T >::walls.

157 {return walls;};
bool walls
Turns off walls before evaluation.
template<StatType T>
Mdouble StatisticsVector< T >::get_xmaxStat ( )
inline

Definition at line 203 of file StatisticsVector.h.

References MD::get_xmax(), and StatisticsVector< T >::xmaxStat.

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

203 {if(std::isnan(xmaxStat)) return get_xmax(); else return xmaxStat;};
Mdouble get_xmax()
Get xmax.
Definition: MD.h:307
template<StatType T>
Mdouble StatisticsVector< T >::get_xminStat ( )
inline

Functions to acces and change the domain of statistics.

Definition at line 200 of file StatisticsVector.h.

References MD::get_xmin(), and StatisticsVector< T >::xminStat.

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

200 {if(std::isnan(xminStat)) return get_xmin(); else return xminStat;};
Mdouble xminStat
By default the points of evaluation are placed in an grid on the domain [xminStat,xmaxStat]x[yminStat,ymaxStat]x[zminStat,zmaxStat].
Mdouble get_xmin()
Get xmin.
Definition: MD.h:305
template<StatType T>
Mdouble StatisticsVector< T >::get_ymaxStat ( )
inline

Definition at line 204 of file StatisticsVector.h.

References MD::get_ymax(), and StatisticsVector< T >::ymaxStat.

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

204 {if(std::isnan(ymaxStat)) return get_ymax(); else return ymaxStat;};
Mdouble get_ymax()
Gets ymax.
Definition: MD.h:311
template<StatType T>
Mdouble StatisticsVector< T >::get_yminStat ( )
inline

Definition at line 201 of file StatisticsVector.h.

References MD::get_ymin(), and StatisticsVector< T >::yminStat.

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

201 {if(std::isnan(yminStat)) return get_ymin(); else return yminStat;};
Mdouble get_ymin()
Gets ymin.
Definition: MD.h:309
template<StatType T>
Mdouble StatisticsVector< T >::get_zmaxStat ( )
inline

Definition at line 205 of file StatisticsVector.h.

References MD::get_zmax(), and StatisticsVector< T >::zmaxStat.

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

205 {if(std::isnan(zmaxStat)) return get_zmax(); else return zmaxStat;};
Mdouble get_zmax()
Gets zmax.
Definition: MD.h:315
template<StatType T>
Mdouble StatisticsVector< T >::get_zminStat ( )
inline

Definition at line 202 of file StatisticsVector.h.

References MD::get_zmin(), and StatisticsVector< T >::zminStat.

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

202 {if(std::isnan(zminStat)) return get_zmin(); else return zminStat;};
Mdouble get_zmin()
Gets zmin.
Definition: MD.h:313
template<StatType T>
Vec3D StatisticsVector< T >::getVelocityProfile ( Vec3D  Position)
protected

Definition at line 307 of file StatisticsVector.hcc.

References X, Vec3D::X, Y, Vec3D::Y, Z, and Vec3D::Z.

308 {
309  double i,j,k;
310  double l,m,n;
311  l = modf ((double)(Position.X-VelocityProfile_Min.X)/VelocityProfile_D.X, &i);
312  m = modf ((double)(Position.Y-VelocityProfile_Min.Y)/VelocityProfile_D.Y, &j);
313  n = modf ((double)(Position.Z-VelocityProfile_Min.Z)/VelocityProfile_D.Z, &k);
314  if (nx<1) i=0;
315  if (ny<1) j=0;
316  if (ny<1) k=0;
317  int ix = (i*ny+j)*nz+k;
318  Vec3D V;
319  if (nx<=1) V.X = VelocityProfile[ix].X;
320  else V.X=VelocityProfile[ix].X*(1-l)+VelocityProfile[ix+ny*nz].X*l;
321  if (ny<=1) V.Y = VelocityProfile[ix].Y;
322  else V.Y=VelocityProfile[ix].Y*(1-m)+VelocityProfile[ix+nz].Y*m;
323  if (nz<=1) V.Z = VelocityProfile[ix].Z;
324  else V.Z=VelocityProfile[ix].Z*(1-n)+VelocityProfile[ix+1].Z*n;
325  return V;
326 }
Mdouble X
Definition: Vector.h:44
std::vector< Vec3D > VelocityProfile
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
Mdouble Y
Definition: Vector.h:44
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble Z
Definition: Vector.h:44
template<StatType T>
void StatisticsVector< T >::initialize_statistics ( )
virtual

Initializes statistics, i.e. setting w2, setting the grid and writing the header lines in the .stat file.

This creates the file statistics will be saved to

Reimplemented from MD.

Definition at line 658 of file StatisticsVector.hcc.

References StatisticsVector< T >::set_Positions(), and StatisticsVector< T >::set_w2().

659 {
661 
663 
665 
666  //set tmin and tmax if tint is set
667  if (get_tintStat()) {
668  set_tminStat(get_t());
670  std::cout << "tint set, time goes from: " << get_tminStat() << " to: " << get_tmaxStat() << std::endl;
671  }
672 
674  if (!strcmp(get_stat_filename().c_str(),"")) set_stat_filename(); //set ouput filename to default unless otherwise specified
675  if(!open_stat_file(std::fstream::out)) {std::cerr << "Problem opening stat file aborting" <<std::endl; exit(-1);};
676 
677  get_stat_file() << Points.begin()->write_variable_names() << std::endl;
678  get_stat_file() << print_CG() << std::endl;
679 
680  //std::couts variables
681  if (verbosity>1) std::cout << std::endl;
682  if (verbosity>0) std::cout << std::endl << print() << std::endl;
683 
684 }
Mdouble get_tminStat()
Mdouble get_tintStat()
void set_tmaxStat(Mdouble t)
void set_w2(Mdouble new_)
Set CG variables w2 and CG_invvolume.
void set_Positions()
Set position of StatisticsPoint points and set variables to 0.
std::string print()
Outputs member variable values to a std::string.
void set_tminStat(Mdouble t)
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
std::fstream & get_stat_file()
Allows the problem_name to be accessed.
Definition: STD_save.h:132
Mdouble get_tmaxStat()
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
std::string get_stat_filename()
Definition: STD_save.h:150
This class is used to extract statistical data from MD simulations.
virtual void reset_statistics()
Set all statistical variables to zero.
void set_stat_filename()
Definition: STD_save.h:145
std::string print_CG()
Output coarse graining variables.
bool open_stat_file(std::fstream::openmode mode=std::fstream::out)
Definition: STD_save.h:190
template<StatType T>
void StatisticsVector< T >::jump_fstat ( )

Definition at line 1493 of file StatisticsVector.hcc.

1494 {
1495  if (get_options_fstat()==2) {
1496  increase_counter_fstat(std::fstream::in);
1497  if (verbosity>1) std::cout << "Using fstat file counter: "<<get_file_counter() << std::endl;
1498  } else {
1499  //read in first three lines (should start with '#')
1500  std::string dummy;
1501  getline (get_fstat_file(), dummy);
1502  getline (get_fstat_file(), dummy);
1503  getline (get_fstat_file(), dummy);
1504  //read in all lines belonging to this timestep
1505  while ( (get_fstat_file().peek() != -1) && (get_fstat_file().peek() != '#') )
1506  getline (get_fstat_file(), dummy);
1507  }
1508 }
int get_file_counter()
Definition: STD_save.h:234
unsigned int get_options_fstat(void)
Definition: STD_save.h:159
bool increase_counter_fstat(std::fstream::openmode mode)
Definition: STD_save.h:217
std::fstream & get_fstat_file()
Allows the problem_name to be accessed.
Definition: STD_save.h:134
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
template<StatType T>
void StatisticsVector< T >::jump_p3c ( )

get force statistics from particle collisions

Definition at line 1136 of file StatisticsVector.hcc.

1137 {
1138  std::string dummyStr;
1139  Mdouble N, dummy;
1140 
1141  //Ignoring first line
1142  getline(p3c_file, dummyStr);
1143  std::cout << dummyStr << std::endl;
1144  //Reading second line
1145  p3c_file >> dummy; set_t(dummy);
1146  p3c_file >> N;
1147  std::cout << "ignoring t= " << get_t() << ": loading " << N << " contacts ..." << std::endl;
1148  getline(p3c_file,dummyStr);
1149  //Ignoring third line
1150  getline(p3c_file,dummyStr);
1151  std::cout << dummyStr << std::endl;
1152  //go through N lines in the p3c file
1153  for (int i=0; i<N; i++) getline(p3c_file,dummyStr);
1154 
1155  //Ignoring first line
1156  getline(p3w_file, dummyStr);
1157  std::cout << dummyStr << std::endl;
1158  //Reading second line
1159  p3w_file >> dummy; set_t(dummy);
1160  p3w_file >> N;
1161  std::cout << "ignoring t= " << get_t() << ": loading " << N << " wall contacts ..." << std::endl;
1162  getline(p3w_file,dummyStr);
1163  //Ignoring third line
1164  getline(p3w_file,dummyStr);
1165  //go through N lines in the p3w file
1166  for (int i=0; i<N; i++) getline(p3w_file,dummyStr);
1167 
1168 }
std::fstream p3w_file
void set_t(Mdouble new_t)
Access function for the time.
Definition: MD.h:110
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
double Mdouble
Definition: ExtendedMath.h:33
std::fstream p3c_file
template<StatType T>
bool StatisticsVector< T >::loadVelocityProfile ( const char *  filename)
protected

Definition at line 247 of file StatisticsVector.hcc.

References Vec3D::X, Vec3D::Y, and Vec3D::Z.

248 {
249  //This opens the file the data will be recalled from
250  std::fstream is;
251  is.open(filename, std::fstream::in);
252  if (!is.is_open()||is.bad()) {
253  std::cout << "Loading data file " << filename << " failed" << std::endl;
254  return false;
255  }
256 
257  //Read the file; we assume that the stat file we read in has the same stattype and domain size as the problem.
258  std::string line_string;
259  getline(is,line_string);
260  std::string dummy;
261  is >> dummy >> dummy;
262  is >> dummy >> dummy;
263  double xmin, xmax, ymin, ymax, zmin, zmax;
264  is >> dummy >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax;
265  VelocityProfile_Min = Vec3D(xmin,ymin,zmin);
266  double nx, ny, nz;
267  is >> dummy >> nx >> ny >> nz;
268  double dx = (xmax-xmin)/(nx-1);
269  double dy = (ymax-ymin)/(ny-1);
270  double dz = (zmax-zmin)/(nz-1);
271  VelocityProfile_D = Vec3D(dx,dy,dz);
272  std::string statType;
273  is >> dummy >> statType;
274  getline(is,line_string);
275  getline(is,line_string);
276 
277  set_nx(nx);
278  set_ny(ny);
279  set_nz(nz);
280  set_xminStat(xmin);
281  set_yminStat(ymin);
282  set_zminStat(zmin);
283  set_xmaxStat(xmax);
284  set_ymaxStat(ymax);
285  set_zmaxStat(zmax);
286 
287  VelocityProfile.resize(nx*ny*nz);
288  Vec3D M;
289  double rho;
290  int n=0;
291  for (int i=0; i<nx; i++)
292  for (int j=0; j<ny; j++)
293  for (int k=0; k<nz; k++) {
294  is >> dummy >> dummy >> dummy >> dummy >> rho >> M.X >> M.Y >> M.Z;
295  getline(is,line_string);
296  VelocityProfile[n]=M/rho;
297  n++;
298  }
299 
300  //Close the file
301  is.close();
302  std::cout << "Loaded data file " << filename << std::endl;
303  return true;
304 }
Mdouble X
Definition: Vector.h:44
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
void set_yminStat(Mdouble yminStat_)
void set_zminStat(Mdouble zminStat_)
std::vector< Vec3D > VelocityProfile
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
std::vector< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
void set_zmaxStat(Mdouble zmaxStat_)
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
void set_nz(int new_)
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
void set_nx(int new_)
void set_xminStat(Mdouble xminStat_)
Mdouble xmax
Definition: MD.h:668
void set_ymaxStat(Mdouble ymaxStat_)
Mdouble zmax
Definition: MD.h:668
void set_xmaxStat(Mdouble xmaxStat_)
Mdouble Y
Definition: Vector.h:44
void set_ny(int new_)
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 Z
Definition: Vector.h:44
Mdouble ymin
Definition: MD.h:668
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
template<StatType T>
void StatisticsVector< T >::output_statistics ( )
virtual

Calculates statistics for Particles (i.e. not collisions)

Because the domain can change in size some stuff has to be updated

Todo:
{Particles shouldn't be unfixed, in case you do live statistics; please correct}
Todo:
We now have an idea of how to deal with fixed particles better, so this can be improved.

Reimplemented from MD.

Definition at line 1826 of file StatisticsVector.hcc.

1826  {
1828  {
1830  for (unsigned int i=0; i<Points.size(); i++)
1831  Points[i].set_CG_invvolume();
1832 
1833  for (std::vector<BaseParticle*>::iterator P = getParticleHandler().begin(); P!=getParticleHandler().end(); ++P) {
1835  //unfix particles (turn off to ignore fixed particles)
1836  if ((!ignoreFixedParticles) && (*P)->isFixed()) {
1837  (*P)->unfix(get_Species());
1838  }
1839  //ignore fixed particles
1840 
1842  if (satisfiesInclusionCriteria(*P) && !(*P)->isFixed()) {
1844  }
1845 
1846  }
1847  }
1848 }
std::vector< CSpecies > & get_Species(void)
Allows the species to be copied.
Definition: MD.h:126
bool check_current_time_for_statistics()
bool satisfiesInclusionCriteria(BaseParticle *P)
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
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 evaluate_particle_statistics(std::vector< BaseParticle * >::iterator P, int wp=0)
Calculates statistics for a single Particle.
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
ParticleHandler & getParticleHandler()
Definition: MD.h:147
bool ignoreFixedParticles
Determines if fixed particles contribute to particle statistics (density, ...)
template<StatType T>
std::string StatisticsVector< T >::print ( )

Outputs member variable values to a std::string.

Outputs StatisticsVector.

Definition at line 584 of file StatisticsVector.hcc.

References Gaussian, HeavisideSphere, and Polynomial.

584  {
585  std::stringstream ss;
586  ss << "Statistical parameters: name=" << get_name()
587  << ",\n nx=" << nx
588  << ", ny=" << ny
589  << ", nz=" << nz
590  << ", CG_type=";
591  if (get_CG_type()==HeavisideSphere) {
592  ss << "HeavisideSphere";
593  } else if (get_CG_type()==Gaussian) {
594  ss << "Gaussian";
595  } else if (get_CG_type()==Polynomial) {
596  ss << get_PolynomialName();
597  } else { std::cerr << "error in CG_function" << std::endl; exit(-1); }
598 
599  ss << ", w=" << sqrt(w2)
600  << ", cutoff=" << cutoff
601  << ",\n tStat=[" << get_tminStat() << "," << get_tmaxStat() << "]"
602  << ", xStat=[" << get_xminStat() << "," << get_xmaxStat() << "]"
603  << ", yStat=[" << get_yminStat() << "," << get_ymaxStat() << "]"
604  << ", zStat=[" << get_zminStat() << "," << get_zmaxStat() << "]"
605  << ",\n ignoreFixedParticles=" << ignoreFixedParticles
606  << ", StressTypeForFixedParticles=" << StressTypeForFixedParticles
607  << ",\n mirrorAtDomainBoundary=" << get_mirrorAtDomainBoundary()
608  << ",\n doTimeAverage=" << get_doTimeAverage()
609  << ", doVariance=" << get_doVariance()
610  << ", doGradient=" << get_doGradient()
611  << ", verbosity=" << verbosity
612  << std::endl;
613  return ss.str();
614 }
Mdouble get_tminStat()
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Mdouble cutoff
The distance from the origin at which the cg function vanishes; cutoff=w for HeavisideSphere or Polyn...
Mdouble w2
coarse graining width squared; for HeavisideSphere and Gaussian
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
Mdouble get_tmaxStat()
std::string get_PolynomialName()
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
bool ignoreFixedParticles
Determines if fixed particles contribute to particle statistics (density, ...)
std::string get_name()
Allows the problem_name to be accessed.
Definition: STD_save.h:127
Mdouble get_mirrorAtDomainBoundary()
int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
template<StatType T>
std::string StatisticsVector< T >::print_CG ( )

Output coarse graining variables.

Output names of statistical variables.

Todo:
{Thomas: stat file should include all variables such as CGType Stattype gradient timevariance timeaveraged, ...}

Definition at line 619 of file StatisticsVector.hcc.

References Polynomial.

619  {
620  std::stringstream ss;
621  ss << "w " << sqrt(get_w2())
622  << " dim " << get_dim()
623  << " domainStat " << get_xminStat() << " " << get_xmaxStat()
624  << " " << get_yminStat() << " " << get_ymaxStat()
625  << " " << get_zminStat() << " " << get_zmaxStat()
626  << " n " << nx << " " << ny << " " << nz
627  << " statType " << statType;
628  if (CG_type==Polynomial) ss << " CGPolynomial " << CGPolynomial;
629  else ss << " CG_type " << CG_type << " cutoff " << cutoff;
630  if (doVariance) ss << " doVariance";
631  if (doGradient) ss << " doGradient";
632  if (doTimeAverage) {
633  ss << " doTimeAverage";
634  if (nTimeAverageReset!=-1) ss << " nTimeAverageReset " << nTimeAverageReset;
635  }
636  if (indSpecies!=-1) ss << " indSpecies " << indSpecies;
637  if (rmin!=0) ss << " rmin " << rmin;
638  if (rmax!=1e20) ss << " rmax " << rmax;
639  if (hmax!=1e20) ss << " hmax " << hmax;
640  if (!walls) ss << " noWalls";
641  if (!periodicWalls) ss << " noPeriodicWalls";
642  if (!ignoreFixedParticles) ss << " includeFixedParticles";
643  if (StressTypeForFixedParticles!=1) ss << " StressTypeForFixedParticles " << StressTypeForFixedParticles;
644  return ss.str();
645 }
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
bool walls
Turns off walls before evaluation.
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Mdouble cutoff
The distance from the origin at which the cg function vanishes; cutoff=w for HeavisideSphere or Polyn...
int get_dim()
Allows the dimension of the simulation to be accessed.
Definition: MD.h:369
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
int nTimeAverageReset
Determines after how many timesteps the time average is reset.
Mdouble indSpecies
defines the species for which statistics are extracted (-1 for all species)
Mdouble rmin
defines the minimum radius of the particles for which statistics are extracted
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
bool doTimeAverage
Determines if output is averaged over time.
bool doVariance
Determines if variance is outputted.
CG CG_type
coarse graining type (Gaussian, Heaviside, Polynomial)
Mdouble hmax
defines the maximum height of the particles for which statistics are extracted
bool ignoreFixedParticles
Determines if fixed particles contribute to particle statistics (density, ...)
int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
Mdouble rmax
defines the maximum radius of the particles for which statistics are extracted
bool doGradient
Determines if gradient is outputted.
template<StatType T>
void StatisticsVector< T >::print_help ( )

Definition at line 476 of file StatisticsVector.hcc.

477 {
478  std::cout << "fstatistics.exe filename [-options]: " << std::endl
479  << "This program evaluates statistical data from .fstat, .data, and. restart files and writes it into a .stat file" << std::endl << std::endl;
480  std::cout << "OPTIONS:" << std::endl << std::endl;
481  std::cout << "-stattype [X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,AZ,RZ,R,A]: " << std::endl
482  << "Used to obtain statistics averaged in all coordinate directions but the ones specified; f.e. -stattype Z yields depth-profiles. Default is XYZ." << std::endl << std::endl
483  << "-CGtype [HeavisideSphere,Gaussian]: " << std::endl
484  << "Averaging function; default: Gaussian" << std::endl << std::endl
485  << "-w,-w_over_rmax [Mdouble]: " << std::endl
486  << "Averaging width, absolute or in multiples of the radius of the largest particle in the restart file; default: w_over_rmax=1" << std::endl << std::endl
487  << "-n,nx,ny,nz [uint]: " << std::endl
488  << "Specifies the amount of grid points in coordinate directions for which statistics are evaluated; use -n to set all 3 directions at once; is set to one in averaged directions (see stattype). Default n=1" << std::endl << std::endl
489  << "-h,hx,hy,hz [Mdouble]: " << std::endl
490  << "Defines the amount of grid points by setting the mesh size " << std::endl << std::endl
491  << "-x,y,z [Mdouble Mdouble]: " << std::endl
492  << "Specifies the domain of the grid; f.e. for -x 0 1 all grid points will have x-values within [0,1]. Default -x xmin xmax (from restart file)" << std::endl << std::endl
493  << "-indSpecies [int]: " << std::endl
494  << "-rmin,rmax [Mdouble]: " << std::endl
495  << "-hmax [Mdouble]: " << std::endl
496  << "Allows to only obtain statistics for specific particles" << std::endl << std::endl
497  << "-periodicwalls [bool]: " << std::endl
498  << "neglects periodic walls" << std::endl << std::endl
499  << "-walls [uint]: " << std::endl
500  << "only takes into account the first n walls" << std::endl << std::endl
501  << "-verbosity [uint]: " << std::endl
502  << "amount of screen output (0 minimal, 1 normal, 2 maximal)" << std::endl << std::endl
503  << "-verbose: " << std::endl
504  << "identical to -verbosity 2" << std::endl << std::endl
505  << "-format [uint]: " << std::endl
506  << "???" << std::endl << std::endl
507  << "-tmin,tmax,tint [Mdouble]: " << std::endl
508  << "redefines the time interval [tmin,tmax] for which statistics are evaluated. Default values from restart file; tint sets tmin to tmax-tint." << std::endl << std::endl
509  << "-stepsize [uint]: " << std::endl
510  << "to skip some timesteps. Default: 1 " << std::endl << std::endl
511  << "-statfilename [std::string]: " << std::endl
512  << "to change the name of the output file" << std::endl << std::endl
513  << "-timeaverage [bool]: " << std::endl
514  << "To average in time (1) or to print statistics for all time steps (0). Default: 1" << std::endl << std::endl
515  << "-timevariance [bool]: " << std::endl
516  << "to print the time variance; only for time averaged data. Default: ?" << std::endl << std::endl
517  << "-gradient: " << std::endl
518  << "to plot the first derivative of each statistical value" << std::endl << std::endl
519  << "-ignoreFixedParticles: " << std::endl
520  << "-StressTypeForFixedParticles: " << std::endl
521  << "-mirrorAtDomainBoundary [Mdouble]" << std::endl << std::endl
522  << "" << std::endl << std::endl
523  << "OUTPUT:" << std::endl << std::endl
524  << "1-3: Coordinates " << std::endl
525  << "4: Nu " << std::endl
526  << "5: Density " << std::endl
527  << "6-8: Momentum " << std::endl
528  << "9-11: DisplacementMomentum " << std::endl
529  << "12-17: Displacement" << std::endl
530  << "18-23: MomentumFlux" << std::endl
531  << "24-29: DisplacementMomentumFlux" << std::endl
532  << "30-32: EnergyFlux " << std::endl
533  << "33-41: NormalStress " << std::endl
534  << "42-50: TangentialStress " << std::endl
535  << "51-53: NormalTraction " << std::endl
536  << "54-56: TangentialTraction " << std::endl
537  << "57-62: Fabric " << std::endl
538  << "63-65: CollisionalHeatFlux " << std::endl
539  << "66: Dissipation " << std::endl
540  << "67: Potential " << std::endl
541  << "68-70: LocalAngularMomentum " << std::endl
542  << "71-79: LocalAngularMomentumFlux " << std::endl
543  << "80-88: ContactCoupleStress " << std::endl;
544  exit(0);
545 }
template<StatType T>
void StatisticsVector< T >::process_statistics ( bool usethese  )
virtual

Processes all gathered statistics and resets them afterwards. (Processing means either calculating time averages or writing out statistics)

Reimplemented from MD.

Definition at line 736 of file StatisticsVector.hcc.

737 {
738  if (check_current_time_for_statistics()&&usethese)
739  {
741  for (unsigned int i=0; i<Points.size(); i++) {
742  if (Points[i].mirrorParticle>=0) {
743  //add values to the mirrorParticle
744  Points[Points[i].mirrorParticle]+=Points[i];
745  Points[i].set_zero();
746  if (get_doGradient()) {
747  dx[Points[i].mirrorParticle]+=dx[i];
748  dy[Points[i].mirrorParticle]+=dy[i];
749  dz[Points[i].mirrorParticle]+=dz[i];
750  }
751  }
752  }
753  }
754  //~ for (unsigned int i=0; i<Points.size(); i++)
755  //~ Points[i].Displacement /= sqr(Points[i].Density);
756  if (get_doTimeAverage())
757  {
758  for (unsigned int i=0; i<timeAverage.size(); i++)
759  {
760  timeAverage[i] += Points[i];
761  if (get_doVariance())
762  timeVariance[i] += Points[i].getSquared();
763  if (get_doGradient())
764  {
765  dxTimeAverage[i] += dx[i];
766  dyTimeAverage[i] += dy[i];
767  dzTimeAverage[i] += dz[i];
768  }
769  }
770  nTimeAverage++;
772  std::cout << "write time average" << std::endl;
774  nTimeAverage=0;
775  for (unsigned int i=0; i<timeAverage.size(); i++)
776  timeAverage[i].set_zero();
777  }
778  }
779  else
780  {
782  }
783  }
785 }
std::vector< StatisticsPoint< T > > dyTimeAverage
a vector used to sum up all statistical gradients in dy for time-averaging
bool check_current_time_for_statistics()
void write_time_average_statistics()
Writes out time averaged statistics.
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
std::vector< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
void write_statistics()
Writes regular statistics.
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
int nTimeAverage
A counter needed to average over time.
int nTimeAverageReset
Determines after how many timesteps the time average is reset.
std::vector< StatisticsPoint< T > > dxTimeAverage
a vector used to sum up all statistical gradients in dx for time-averaging
std::vector< StatisticsPoint< T > > dzTimeAverage
a vector used to sum up all statistical gradients in dz for time-averaging
std::vector< StatisticsPoint< T > > timeVariance
a vector used to sum up the variance in time of all statistical values
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
std::vector< StatisticsPoint< T > > timeAverage
A vector used to sum up all statistical values in Points for time-averaging.
virtual void reset_statistics()
Set all statistical variables to zero.
Mdouble get_mirrorAtDomainBoundary()
template<StatType T>
bool StatisticsVector< T >::read_next_from_data_file ( unsigned int  format)

Definition at line 687 of file StatisticsVector.hcc.

References MD::read_next_from_data_file().

687  {
688  static unsigned int count = 0;
689 
690  if (count) for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
691  (*it)->set_PreviousPosition((*it)->get_Position());
692  }
693 
694  bool ret_val = MD::read_next_from_data_file (format);
695 
696  if (!count) for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
697  (*it)->set_PreviousPosition((*it)->get_Position());
698  }
699 
700  count++;
701  return ret_val;
702 }
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
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
template<StatType T>
bool StatisticsVector< T >::read_next_from_p3p_file ( )
protected

Definition at line 968 of file StatisticsVector.hcc.

References constants::pi.

969 {
970  //uncomment if you want data file output
971  //MD::output_xballs_data();
972 
973  unsigned int N;
974  Mdouble dummy;
975  std::string dummyStr;
976 
977  //read first parameters and check if we reached the end of the file
978 
979  //Ignoring first line
980  getline(p3p_file,dummyStr);
981  std::cout << dummyStr << std::endl;
982  //Reading second line
983  p3p_file >> dummy; set_t(dummy);
984  p3p_file >> N;
985  std::cout << "t= " << get_t() << ": loading " << N << " particles ..." << std::endl;
986  getline(p3p_file,dummyStr);
987  //std::cout << dummyStr << std::endl;
988  //Ignoring third line
989  getline(p3p_file,dummyStr);
990  std::cout << dummyStr << std::endl;
991  if (p3p_file.eof()||p3p_file.peek()==-1) {std::cout << "reached end of p3p file" << std::endl; return false;}
992 
993  BaseParticle P0;
996  getParticleHandler().copyAndAddParticle(P0);
997  else
998  while(getParticleHandler().getNumberOfObjects()>N)
999  getParticleHandler().removeLastParticle();
1000 
1001  //Read forth to (N+3)rd line
1002  Vec3D dummyVec;
1003  Vec3D position,velocity,angle,angularVelocity;
1004  int dummyInt;
1005  for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
1006  p3p_file >> dummyInt; (*it)->set_Index(dummyInt); //ID
1007  //std::cout << " ID " << (*it)->get_Index() << std::endl;
1008  p3p_file >> dummyInt; (*it)->set_species(dummyInt-1); //Group
1009  p3p_file >> dummy; (*it)->set_Radius(pow(dummy/(4./3.*constants::pi),1./3.)); //Volume
1010  p3p_file >> dummy; (*it)->set_Mass(dummy); //Mass
1011  p3p_file
1012  >> position
1013  >> velocity
1014  >> angularVelocity;
1015  (*it)->set_Position(position);
1016  (*it)->set_Velocity(velocity);
1017  (*it)->set_AngularVelocity(angularVelocity);
1018  //clean up tangential springs
1019  } //end for all particles
1020  //auto_setdim();
1021 
1022  getline(p3p_file,dummyStr);
1023  std::cout << dummyStr << std::endl;
1024 
1025  //fix particles, if data_FixedParticles!=0
1026 
1027  return true;
1028 }
std::fstream p3p_file
void set_t(Mdouble new_t)
Access function for the time.
Definition: MD.h:110
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
const Mdouble pi
Definition: ExtendedMath.h:54
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
ParticleHandler & getParticleHandler()
Definition: MD.h:147
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
template<StatType T>
void StatisticsVector< T >::readStatArguments ( unsigned int  argc,
char *  argv[] 
)
Todo:
this should also set the ene,restart filename

Definition at line 331 of file StatisticsVector.hcc.

References Gaussian, and HeavisideSphere.

332 {
333  //check for options (standardly '-option argument')
334  for (unsigned int i = 2; i<argc; i+=2) {
335  std::cout << "interpreting input argument " << argv[i];
336  if (i+1<argc) std::cout << " " << argv[i+1];
337  std::cout << std::endl;
338 
339  if (!strcmp(argv[i],"-CGtype")) {
340  //CG_type_todo
341  if (!strcmp(argv[i+1],"HeavisideSphere")) {
343  } else if (!strcmp(argv[i+1],"Gaussian")) {
345  } else {
346  set_CG_type(argv[i+1]);
347  }
348  } else if (!strcmp(argv[i],"-w")) {
349  double old = get_w();
350  set_w (atof(argv[i+1]));
351  std::cout << " w changed from " << old << " to " << get_w() << std::endl;
352  } else if (!strcmp(argv[i],"-help")) {
353  print_help();
354  i--; //requires no argument
355  } else if (!strcmp(argv[i],"-velocityprofile")) {
356  loadVelocityProfile(argv[i+1]);
357  } else if (!strcmp(argv[i],"-h")) {
358  set_h (atof(argv[i+1]));
359  } else if (!strcmp(argv[i],"-hx")) {
360  set_hx(atof(argv[i+1]));
361  } else if (!strcmp(argv[i],"-hy")) {
362  set_hy(atof(argv[i+1]));
363  } else if (!strcmp(argv[i],"-hz")) {
364  set_hz(atof(argv[i+1]));
365  } else if (!strcmp(argv[i],"-n")) {
366  set_n(atoi(argv[i+1]));
367  } else if (!strcmp(argv[i],"-nx")) {
368  set_nx(atoi(argv[i+1]));
369  } else if (!strcmp(argv[i],"-ny")) {
370  set_ny(atoi(argv[i+1]));
371  } else if (!strcmp(argv[i],"-nz")) {
372  set_nz(atoi(argv[i+1]));
373  } else if (!strcmp(argv[i],"-x")) {
374  set_xminStat(atof(argv[i+1]));
375  set_xmaxStat(atof(argv[i+2]));
376  i++; //requires two arguments
377  } else if (!strcmp(argv[i],"-y")) {
378  set_yminStat(atof(argv[i+1]));
379  set_ymaxStat(atof(argv[i+2]));
380  i++; //requires two arguments
381  } else if (!strcmp(argv[i],"-z")) {
382  set_zminStat(atof(argv[i+1]));
383  set_zmaxStat(atof(argv[i+2]));
384  i++; //requires two arguments
385  } else if (!strcmp(argv[i],"-indSpecies")) {
386  indSpecies = atoi(argv[i+1]);
387  } else if (!strcmp(argv[i],"-rmin")) {
388  rmin = atof(argv[i+1]);
389  } else if (!strcmp(argv[i],"-rmax")) {
390  rmax = atof(argv[i+1]);
391  } else if (!strcmp(argv[i],"-hmax")) {
392  hmax = atof(argv[i+1]);
393  } else if (!strcmp(argv[i],"-periodicwalls")) {
394  set_periodicWalls(atoi(argv[i+1]));
395  } else if (!strcmp(argv[i],"-walls")) {
396  set_walls(atoi(argv[i+1]));
397  } else if (!strcmp(argv[i],"-verbosity")) {
398  set_verbosity(atoi(argv[i+1]));
399  } else if (!strcmp(argv[i],"-verbose")) {
400  verbose();
401  i--; //requires no argument
402  } else if (!strcmp(argv[i],"-format")) {
403  format = atoi(argv[i+1]);
404  } else if (!strcmp(argv[i],"-doublePoints")) {
405  if (argc<=i+1||argv[i+1][0]=='-') {
406  set_doublePoints(true);
407  i--; //no argument
408  } else set_doublePoints(atoi(argv[i+1]));
409  std::cout << "set doublePoints=" << get_doublePoints() << std::endl;
410  } else if (!strcmp(argv[i],"-w_over_rmax")) {
411  set_w_over_rmax(atof(argv[i+1]));
412  } else if (!strcmp(argv[i],"-tmin")) {
413  set_tminStat(atof(argv[i+1]));
414  } else if (!strcmp(argv[i],"-tmax")) {
415  set_tmaxStat(atof(argv[i+1]));
416  } else if (!strcmp(argv[i],"-tint")) {
417  set_tintStat(atof(argv[i+1]));
418  //~ } else if (!strcmp(argv[i],"-timesteps")) {
419  //~ set_tintStat(atof(argv[i+1])*get_dt());
420  } else if (!strcmp(argv[i],"-stepsize")) {
421  int step_size = atoi(argv[i+1]);
422  set_step_size(step_size);
423  } else if (!strcmp(argv[i],"-loaddatafile")) {
424  load_from_data_file(argv[i+1]);
425  set_tminStat(get_t());
427  } else if (!strcmp(argv[i],"-statfilename") | !strcmp(argv[i],"-o")) {
428  stat_filename.str(argv[i+1]);
430  // set_name(argv[i+1]);
431  } else if (!strcmp(argv[i],"-timeaverage")) {
432  set_doTimeAverage(atoi(argv[i+1]));
433  } else if (!strcmp(argv[i],"-timeaveragereset")) {
434  nTimeAverageReset = atoi(argv[i+1]);
435  } else if (!strcmp(argv[i],"-gradient")) {
436  // use default argument if no argument is given
437  if (argc<=i+1||argv[i+1][0]=='-') {
438  set_doGradient(true);
439  i--; //no argument
440  } else set_doGradient(atoi(argv[i+1]));
441  } else if (!strcmp(argv[i],"-timevariance")) {
442  // use default argument if no argument is given
443  if (argc<=i+1||argv[i+1][0]=='-') {
444  set_doVariance(true);
445  i--; //no argument
446  } else set_doVariance(atoi(argv[i+1]));
447  } else if (!strcmp(argv[i],"-superexact")) {
448  // use default argument if no argument is given
449  if (argc<=i+1||argv[i+1][0]=='-') {
450  set_superexact(true);
451  i--; //no argument
452  } else set_superexact(atoi(argv[i+1]));
453  } else if (!strcmp(argv[i],"-ignoreFixedParticles")) {
454  // use default argument if no argument is given
455  if (argc<=i+1||argv[i+1][0]=='-') {
457  i--; //no argument
458  } else set_ignoreFixedParticles(atoi(argv[i+1]));
459  } else if (!strcmp(argv[i],"-StressTypeForFixedParticles")) {
460  StressTypeForFixedParticles = atoi(argv[i+1]);
461  } else if (!strcmp(argv[i],"-mirrorAtDomainBoundary")) {
462  set_mirrorAtDomainBoundary(atof(argv[i+1]));
463  } else if (!strcmp(argv[i],"-stattype")) {
464  //this was already used in Statistics()
465  } else if (readNextArgument(i, argc, argv)) {
466  //~ std::cout << " (read as MD argument, not statistics)" << std::endl;
467  } else {
468  std::cerr << "Error: option unknown: " << argv[i] << std::endl;
469  exit(-1);
470  }
471  }
472 }
void set_hx(Mdouble hx)
std::stringstream stat_filename
Definition: STD_save.h:247
void set_yminStat(Mdouble yminStat_)
void set_h(Mdouble h)
void set_zminStat(Mdouble zminStat_)
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
bool loadVelocityProfile(const char *filename)
void set_zmaxStat(Mdouble zmaxStat_)
void set_ignoreFixedParticles(bool new_)
void set_nz(int new_)
void set_hy(Mdouble hy)
void set_tmaxStat(Mdouble t)
void set_doublePoints(bool new_)
void set_CG_type(const char *new_)
void set_nx(int new_)
void set_xminStat(Mdouble xminStat_)
void set_hz(Mdouble hz)
void set_doTimeAverage(bool new_)
int nTimeAverageReset
Determines after how many timesteps the time average is reset.
void set_tminStat(Mdouble t)
void set_mirrorAtDomainBoundary(Mdouble new_)
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
Mdouble indSpecies
defines the species for which statistics are extracted (-1 for all species)
void set_step_size(unsigned int new_)
Definition: STD_save.h:154
void set_ymaxStat(Mdouble ymaxStat_)
Mdouble rmin
defines the minimum radius of the particles for which statistics are extracted
void set_xmaxStat(Mdouble xmaxStat_)
virtual int readNextArgument(unsigned int &i, unsigned int argc, char *argv[])
Definition: MD.cc:2554
void set_periodicWalls(bool new_)
void set_doVariance(bool new_)
Mdouble get_tmax()
Allows the upper time limit to be accessed.
Definition: MD.h:144
void set_doGradient(bool new_)
void set_superexact(bool new_)
unsigned int step_size
Definition: STD_save.h:270
void set_tintStat(Mdouble t)
Mdouble hmax
defines the maximum height of the particles for which statistics are extracted
void set_verbosity(int new_)
void set_ny(int new_)
int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
Mdouble rmax
defines the maximum radius of the particles for which statistics are extracted
void set_w(Mdouble w)
Set CG variables w2 and CG_invvolume.
void set_w_over_rmax(Mdouble new_)
void set_walls(bool new_)
template<StatType T>
void StatisticsVector< T >::reset_statistics ( )
virtual

Set all statistical variables to zero.

Definition at line 63 of file StatisticsVector.hcc.

63  {
64  for (unsigned int i=0; i<Points.size(); i++) Points[i].set_zero();
65  if (get_doGradient()) for (unsigned int i=0; i<Points.size(); i++) {
66  dx[i].set_zero(); dy[i].set_zero(); dz[i].set_zero();
67  }
68  for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
69  (*it)->set_PreviousPosition((*it)->get_Position());
70  }
71 }
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
std::vector< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
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
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
ParticleHandler & getParticleHandler()
Definition: MD.h:147
template<StatType T>
bool StatisticsVector< T >::satisfiesInclusionCriteria ( BaseParticle P)
protected

Definition at line 1511 of file StatisticsVector.hcc.

References BaseParticle::get_Position(), BaseParticle::get_Radius(), and Vec3D::Z.

1511  {
1512  return P->get_Radius()>rmin
1513  && P->get_Radius()<rmax
1514  && P->get_Position().Z<hmax;
1515 }
Mdouble get_Radius() const
Mdouble rmin
defines the minimum radius of the particles for which statistics are extracted
const Vec3D & get_Position() const
Mdouble hmax
defines the maximum height of the particles for which statistics are extracted
Mdouble Z
Definition: Vector.h:44
Mdouble rmax
defines the maximum radius of the particles for which statistics are extracted
template<StatType T>
void StatisticsVector< T >::set_CG_type ( const char *  new_)

Definition at line 548 of file StatisticsVector.hcc.

References Gaussian, HeavisideSphere, and Polynomial.

548  {
549  if (!strcmp(new_,"Heaviside")) {
550  int dim = 3;
551  int numcoeff = 1;
552  double heavisidecoeff[] = {1};
553  set_Polynomial(heavisidecoeff, numcoeff, dim);
554  } else if (!strcmp(new_,"Linear")) {
555  int dim = 3;
556  int numcoeff = 2;
557  double lincoeff[] = {-1,1};
558  set_Polynomial(lincoeff, numcoeff, dim);
559  } else if (!strcmp(new_,"Lucy")) {
560  int dim = 3;
561  int numcoeff = 5;
562  double lucycoeff[] = {-3,8,-6,0,1};
563  set_Polynomial(lucycoeff, numcoeff, dim);
564  } else if (!strcmp(new_,"Gaussian")) {
565  set_CG_type(Gaussian); return;
566  } else if (!strcmp(new_,"HeavisideSphere")) {
567  set_CG_type(HeavisideSphere); return;
568  } else {
569  std::cerr << "Error: unknown CG_type: " << new_ << std::endl;
570  exit(-1);
571  }
572  set_PolynomialName(new_);
574 }
int dim
The dimension of the simulation.
Definition: MD.h:660
void set_CG_type(const char *new_)
void set_Polynomial(std::vector< Mdouble > new_coefficients, unsigned int new_dim)
void set_PolynomialName(const char *new_name)
template<StatType T>
void StatisticsVector< T >::set_CG_type ( CG  new_)

Definition at line 577 of file StatisticsVector.hcc.

References Polynomial.

577  {
578  if (new_==Polynomial&&CGPolynomial.get_Order()<0) {std::cerr << "Polynomial is not specified" << std::endl; exit(-1);}
579  CG_type = new_;
580 }
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
CG CG_type
coarse graining type (Gaussian, Heaviside, Polynomial)
template<StatType T>
void StatisticsVector< T >::set_doGradient ( bool  new_)
inline

Definition at line 143 of file StatisticsVector.h.

References StatisticsVector< T >::doGradient.

143 {doGradient = new_;};
bool doGradient
Determines if gradient is outputted.
template<StatType T>
void StatisticsVector< T >::set_doTimeAverage ( bool  new_)
inline

Definition at line 128 of file StatisticsVector.h.

References StatisticsVector< T >::doTimeAverage.

128 {doTimeAverage = new_;};
bool doTimeAverage
Determines if output is averaged over time.
template<StatType T>
void StatisticsVector< T >::set_doublePoints ( bool  new_)
inline

Definition at line 232 of file StatisticsVector.h.

References StatisticsVector< T >::doublePoints.

232 {doublePoints=new_;}
template<StatType T>
void StatisticsVector< T >::set_doVariance ( bool  new_)
inline

Definition at line 140 of file StatisticsVector.h.

References StatisticsVector< T >::doVariance.

140 {doVariance = new_;};
bool doVariance
Determines if variance is outputted.
template<StatType T>
void StatisticsVector< T >::set_h ( Mdouble  h)
inline

Definition at line 81 of file StatisticsVector.h.

References StatisticsVector< T >::set_hx(), StatisticsVector< T >::set_hy(), and StatisticsVector< T >::set_hz().

81 { set_hx(h); set_hy(h); set_hz(h);};
void set_hx(Mdouble hx)
void set_hy(Mdouble hy)
void set_hz(Mdouble hz)
template<StatType T>
void StatisticsVector< T >::set_hmax ( Mdouble  new_)
inline

Definition at line 242 of file StatisticsVector.h.

References StatisticsVector< T >::hmax.

242 {hmax=new_;}
Mdouble hmax
defines the maximum height of the particles for which statistics are extracted
template<StatType T>
void StatisticsVector< T >::set_hx ( Mdouble  hx)
inline

Definition at line 75 of file StatisticsVector.h.

References StatisticsVector< T >::get_xmaxStat(), StatisticsVector< T >::get_xminStat(), and StatisticsVector< T >::set_nx().

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

75 { set_nx( ceil((get_xmaxStat()-get_xminStat())/hx) ); };
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
void set_nx(int new_)
template<StatType T>
void StatisticsVector< T >::set_hy ( Mdouble  hy)
inline
template<StatType T>
void StatisticsVector< T >::set_hz ( Mdouble  hz)
inline
template<StatType T>
void StatisticsVector< T >::set_ignoreFixedParticles ( bool  new_)
inline

Definition at line 149 of file StatisticsVector.h.

References StatisticsVector< T >::ignoreFixedParticles.

149 {ignoreFixedParticles = new_;};
bool ignoreFixedParticles
Determines if fixed particles contribute to particle statistics (density, ...)
template<StatType T>
void StatisticsVector< T >::set_infiniteStressForFixedParticles ( bool  new_)
inline

Definition at line 135 of file StatisticsVector.h.

References StatisticsVector< T >::StressTypeForFixedParticles.

135 {StressTypeForFixedParticles = 2+new_;};
int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
template<StatType T>
void StatisticsVector< T >::set_mirrorAtDomainBoundary ( Mdouble  new_)
inline

Definition at line 137 of file StatisticsVector.h.

References StatisticsVector< T >::mirrorAtDomainBoundary.

137 {mirrorAtDomainBoundary = new_;};
Mdouble mirrorAtDomainBoundary
template<StatType T>
void StatisticsVector< T >::set_n ( int  n)
inline

Definition at line 80 of file StatisticsVector.h.

References StatisticsVector< T >::set_nx(), StatisticsVector< T >::set_ny(), and StatisticsVector< T >::set_nz().

80 { set_nx(n); set_ny(n); set_nz(n); };
void set_nz(int new_)
void set_nx(int new_)
void set_ny(int new_)
template<StatType T>
void StatisticsVector< T >::set_n ( int  nx_,
int  ny_,
int  nz_ 
)
inline

Definition at line 97 of file StatisticsVector.h.

References StatisticsVector< T >::nx, StatisticsVector< T >::ny, and StatisticsVector< T >::nz.

97 {nx=nx_; ny=ny_; nz=nz_;};
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
template<StatType T>
void StatisticsVector< T >::set_nx ( int  new_)
inline

Definition at line 74 of file StatisticsVector.h.

References StatisticsVector< T >::nx.

Referenced by StatisticsVector< T >::set_hx(), and StatisticsVector< T >::set_n().

74 { nx = new_;};
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
template<>
void StatisticsVector< YZ >::set_nx ( int new_  UNUSED)

Definition at line 1955 of file StatisticsVector.hcc.

1955 { nx = 1; }
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
template<>
void StatisticsVector< Y >::set_nx ( int new_  UNUSED)

Definition at line 1958 of file StatisticsVector.hcc.

1958 { nx = 1; }
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
template<>
void StatisticsVector< Z >::set_nx ( int new_  UNUSED)

Definition at line 1960 of file StatisticsVector.hcc.

1960 { nx = 1; }
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
template<>
void StatisticsVector< O >::set_nx ( int new_  UNUSED)

Definition at line 1962 of file StatisticsVector.hcc.

1962 { nx = 1; }
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
template<StatType T>
void StatisticsVector< T >::set_ny ( int  new_)
inline

Definition at line 76 of file StatisticsVector.h.

References StatisticsVector< T >::ny.

Referenced by StatisticsVector< T >::set_hy(), and StatisticsVector< T >::set_n().

76 { ny = new_;};
template<>
void StatisticsVector< XZ >::set_ny ( int new_  UNUSED)

Definition at line 1954 of file StatisticsVector.hcc.

1954 { ny = 1; }
template<>
void StatisticsVector< X >::set_ny ( int new_  UNUSED)

Definition at line 1956 of file StatisticsVector.hcc.

1956 { ny = 1; }
template<>
void StatisticsVector< Z >::set_ny ( int new_  UNUSED)

Definition at line 1961 of file StatisticsVector.hcc.

1961 { ny = 1; }
template<>
void StatisticsVector< O >::set_ny ( int new_  UNUSED)

Definition at line 1963 of file StatisticsVector.hcc.

1963 { ny = 1; }
template<StatType T>
void StatisticsVector< T >::set_nz ( int  new_)
inline

Definition at line 78 of file StatisticsVector.h.

References MD::get_dim(), and StatisticsVector< T >::nz.

Referenced by StatisticsVector< T >::set_hz(), and StatisticsVector< T >::set_n().

78 { nz = new_; if (get_dim()<3) std::cerr << "Warning in set_nz: dimension less than 3"<<std::endl; };
int get_dim()
Allows the dimension of the simulation to be accessed.
Definition: MD.h:369
template<>
void StatisticsVector< XY >::set_nz ( int new_  UNUSED)

Definition at line 1953 of file StatisticsVector.hcc.

1953 { nz = 1; }
template<>
void StatisticsVector< X >::set_nz ( int new_  UNUSED)

Definition at line 1957 of file StatisticsVector.hcc.

1957 { nz = 1; }
template<>
void StatisticsVector< Y >::set_nz ( int new_  UNUSED)

Definition at line 1959 of file StatisticsVector.hcc.

1959 { nz = 1; }
template<>
void StatisticsVector< O >::set_nz ( int new_  UNUSED)

Definition at line 1964 of file StatisticsVector.hcc.

1964 { nz = 1; }
template<StatType T>
void StatisticsVector< T >::set_periodicWalls ( bool  new_)
inline

Definition at line 159 of file StatisticsVector.h.

References StatisticsVector< T >::periodicWalls.

Referenced by Statistics().

159 {periodicWalls = new_;};
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
template<StatType T>
void StatisticsVector< T >::set_Polynomial ( std::vector< Mdouble new_coefficients,
unsigned int  new_dim 
)
inline

Definition at line 216 of file StatisticsVector.h.

References StatisticsVector< T >::CGPolynomial.

216  {
217  CGPolynomial.set_polynomial(new_coefficients, new_dim);
218  }
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
template<StatType T>
void StatisticsVector< T >::set_Polynomial ( Mdouble new_coefficients,
unsigned int  num_coeff,
unsigned int  new_dim 
)
inline

Definition at line 220 of file StatisticsVector.h.

References StatisticsVector< T >::CGPolynomial.

220  {
221  CGPolynomial.set_polynomial(new_coefficients, num_coeff, new_dim);
222  }
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
template<StatType T>
void StatisticsVector< T >::set_PolynomialName ( const char *  new_name)
inline

Definition at line 224 of file StatisticsVector.h.

References StatisticsVector< T >::CGPolynomial.

224  {
225  CGPolynomial.set_name(new_name);
226  }
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
template<StatType T>
void StatisticsVector< T >::set_Positions ( )

Set position of StatisticsPoint points and set variables to 0.

Set position of statistics points and set variables to 0.

Definition at line 1365 of file StatisticsVector.hcc.

References A, AZ, R, RA, RAZ, RZ, X, Vec3D::X, XY, XYZ, XZ, Y, Vec3D::Y, YZ, Z, and Vec3D::Z.

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

1366 {
1367  //Dimensions of the domain / n
1368  Vec3D diff = Vec3D(
1369  (get_xmaxStat()-get_xminStat())/nx,
1371  (get_zmaxStat()-get_zminStat())/nz);
1372  //Center of the domain
1373  Vec3D avg = 0.5 * Vec3D(
1377  //Left endpoint of the domain
1378  Vec3D Min = Vec3D(
1379  get_xminStat(),
1380  get_yminStat(),
1381  get_zminStat());
1382 
1383  int num[3]={0,0,0};
1385  if (statType==X||statType==XY||statType==XZ||statType==XYZ) {
1386  //add so many points to domain on both ends
1387  //todo: the 8 is arbitrary
1388  num[0] = floor(std::max(get_mirrorAtDomainBoundary(),get_cutoff())/diff.X);
1389  nx+=2*num[0];
1390  Min.X-=num[0]*diff.X;
1391  }
1392  if (statType==Y||statType==XY||statType==YZ||statType==XYZ) {
1393  num[1] = floor(std::max(get_mirrorAtDomainBoundary(),get_cutoff())/diff.Y);
1394  ny+=2*num[1];
1395  Min.Y-=num[1]*diff.Y;
1396  }
1397  if (statType==Z||statType==XZ||statType==XZ||statType==XYZ) {
1398  num[2] = floor(std::max(get_mirrorAtDomainBoundary(),get_cutoff())/diff.Z);
1399  nz+=2*num[2];
1400  Min.Z-=num[2]*diff.Z;
1401  }
1402  }
1403 
1404  //Set position of statistics points and set variables to 0
1405  int N =std::max(nx,1)*std::max(ny,1)*std::max(nz,1);
1406  Points.resize(N);
1407  int n = 0;
1408  for (int i=0; i<std::max(nx,1); i++)
1409  for (int j=0; j<std::max(ny,1); j++)
1410  for (int k=0; k<std::max(nz,1); k++) {
1411  Points[n].set_Position( Vec3D( (nx>1)?(Min.X+diff.X*(i+0.5)):avg.X,
1412  (ny>1)?(Min.Y+diff.Y*(j+0.5)):avg.Y,
1413  (nz>1)?(Min.Z+diff.Z*(k+0.5)):avg.Z ));
1414  if (doublePoints) Points[n].set_Position( Points[n].get_Position()
1415  -Vec3D((i%2)?(0.99*diff.X):0,(j%2)?(0.99*diff.Y):0,(k%2)?(0.99*diff.Z):0) );
1416  Points[n].set_CG_invvolume();
1417  Points[n].set_zero();
1419  if ((i<num[0])||(i>nx-num[0])||(j<num[1])||(j>ny-num[1])||(k<num[2])||(k>nz-num[2])) {
1420  Points[n].mirrorParticle = n +
1421  + ((i<num[0])?(2*(num[0]-i)-1)*ny*nz:0)+((i>nx-num[0])?(2*(nx-num[0]-i)+1)*ny*nz:0)
1422  + ((j<num[1])?(2*(num[1]-j)-1)*nz:0 )+((j>ny-num[1])?(2*(ny-num[1]-j)+1)*nz:0)
1423  + ((k<num[2])?(2*(num[2]-k)-1):0 )+((k>nz-num[2])?(2*(nz-num[2]-k)+1):0);
1424  }
1425  n++;
1426  }
1427  if (statType==RAZ || statType==RZ || statType==RA || statType==AZ || statType==R || statType==A) {
1428  for (unsigned int k=0; k<Points.size(); k++) {
1429  Points[k].set_Position(Points[k].get_Position().GetFromCylindricalCoordinates());
1430  }
1431  }
1432  if (get_doGradient()) {
1433  dx.resize(N);
1434  dy.resize(N);
1435  dz.resize(N);
1436  for (int n=0; n<N; n++) {
1437  dx[n].set_Position(Points[n].get_Position());
1438  dx[n].mirrorParticle=Points[n].mirrorParticle;
1439  dx[n].set_zero();
1440  dy[n].set_Position(Points[n].get_Position());
1441  dy[n].mirrorParticle=Points[n].mirrorParticle;
1442  dy[n].set_zero();
1443  dz[n].set_Position(Points[n].get_Position());
1444  dz[n].mirrorParticle=Points[n].mirrorParticle;
1445  dz[n].set_zero();
1446  }
1447  }
1448 
1449  //Set TimeAverage the same way
1450  if (get_doTimeAverage()) {
1451  timeAverage.resize(N);
1452  int n = 0;
1453  for (int i=0; i<std::max(nx,1); i++)
1454  for (int j=0; j<std::max(ny,1); j++)
1455  for (int k=0; k<std::max(nz,1); k++) {
1456  timeAverage[n].set_Position(Points[n].get_Position());
1457  timeAverage[n].set_zero();
1458  timeAverage[n].mirrorParticle=Points[n].mirrorParticle;
1459  n++;
1460  }
1461 
1462  if (get_doVariance()) {
1463  timeVariance.resize(N);
1464  for (int n=0; n<N; n++) {
1465  timeVariance[n].set_Position(timeAverage[n].get_Position());
1466  timeVariance[n].mirrorParticle=Points[n].mirrorParticle;
1467  timeVariance[n].set_zero();
1468  }
1469  }
1470 
1471  if (get_doGradient()) {
1472  dxTimeAverage.resize(N);
1473  dyTimeAverage.resize(N);
1474  dzTimeAverage.resize(N);
1475  for (int n=0; n<N; n++) {
1476  dxTimeAverage[n].set_Position(timeAverage[n].get_Position());
1477  dxTimeAverage[n].mirrorParticle=Points[n].mirrorParticle;
1478  dxTimeAverage[n].set_zero();
1479  dyTimeAverage[n].set_Position(timeAverage[n].get_Position());
1480  dyTimeAverage[n].mirrorParticle=Points[n].mirrorParticle;
1481  dyTimeAverage[n].set_zero();
1482  dzTimeAverage[n].set_Position(timeAverage[n].get_Position());
1483  dzTimeAverage[n].mirrorParticle=Points[n].mirrorParticle;
1484  dzTimeAverage[n].set_zero();
1485  }
1486  }
1487 
1488  } //end if (get_doTimeAverage())
1489 }
std::vector< StatisticsPoint< T > > dyTimeAverage
a vector used to sum up all statistical gradients in dy for time-averaging
Mdouble X
Definition: Vector.h:44
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
std::vector< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
std::vector< StatisticsPoint< T > > dxTimeAverage
a vector used to sum up all statistical gradients in dx for time-averaging
std::vector< StatisticsPoint< T > > dzTimeAverage
a vector used to sum up all statistical gradients in dz for time-averaging
std::vector< StatisticsPoint< T > > timeVariance
a vector used to sum up the variance in time of all statistical values
Mdouble Y
Definition: Vector.h:44
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
std::vector< StatisticsPoint< T > > timeAverage
A vector used to sum up all statistical values in Points for time-averaging.
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Mdouble get_mirrorAtDomainBoundary()
Mdouble Z
Definition: Vector.h:44
template<StatType T>
void StatisticsVector< T >::set_rmax ( Mdouble  new_)
inline

Definition at line 241 of file StatisticsVector.h.

References StatisticsVector< T >::rmax.

241 {rmax=new_;}
Mdouble rmax
defines the maximum radius of the particles for which statistics are extracted
template<StatType T>
void StatisticsVector< T >::set_rmin ( Mdouble  new_)
inline

Definition at line 240 of file StatisticsVector.h.

References StatisticsVector< T >::rmin.

240 {rmin=new_;}
Mdouble rmin
defines the minimum radius of the particles for which statistics are extracted
template<StatType T>
void StatisticsVector< T >::set_statType ( )
template<>
void StatisticsVector< RAZ >::set_statType ( )

Definition at line 1966 of file StatisticsVector.hcc.

References RAZ.

1966 { statType=RAZ; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< RZ >::set_statType ( )

Definition at line 1967 of file StatisticsVector.hcc.

References RZ.

1967 { statType=RZ; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< AZ >::set_statType ( )

Definition at line 1968 of file StatisticsVector.hcc.

References AZ.

1968 { statType=AZ; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< RA >::set_statType ( )

Definition at line 1969 of file StatisticsVector.hcc.

References RA.

1969 { statType=RA; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< A >::set_statType ( )

Definition at line 1970 of file StatisticsVector.hcc.

References A.

1970 { statType=A; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< R >::set_statType ( )

Definition at line 1971 of file StatisticsVector.hcc.

References R.

1971 { statType=R; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< XYZ >::set_statType ( )

Definition at line 1972 of file StatisticsVector.hcc.

References XYZ.

1972 { statType=XYZ; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< XY >::set_statType ( )

Definition at line 1973 of file StatisticsVector.hcc.

References XY.

1973 { statType=XY; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< XZ >::set_statType ( )

Definition at line 1974 of file StatisticsVector.hcc.

References XZ.

1974 { statType=XZ; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< YZ >::set_statType ( )

Definition at line 1975 of file StatisticsVector.hcc.

References YZ.

1975 { statType=YZ; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< X >::set_statType ( )

Definition at line 1976 of file StatisticsVector.hcc.

References X.

1976 { statType=X; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< Y >::set_statType ( )

Definition at line 1977 of file StatisticsVector.hcc.

References Y.

1977 { statType=Y; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< Z >::set_statType ( )

Definition at line 1978 of file StatisticsVector.hcc.

References Z.

1978 { statType=Z; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<>
void StatisticsVector< O >::set_statType ( )

Definition at line 1979 of file StatisticsVector.hcc.

References O.

1979 { statType=O; }
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
template<StatType T>
void StatisticsVector< T >::set_StressTypeForFixedParticles ( int  new_)
inline

Definition at line 131 of file StatisticsVector.h.

References StatisticsVector< T >::StressTypeForFixedParticles.

int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
template<StatType T>
void StatisticsVector< T >::set_superexact ( bool  new_)
inline

Definition at line 146 of file StatisticsVector.h.

References StatisticsVector< T >::superexact.

146 {superexact = new_;};
bool superexact
If true, cutoff radius for Gaussian is set to 5*w (from 3*w)
template<StatType T>
void StatisticsVector< T >::set_TimeAverageReset ( int  new_)
inline

Definition at line 236 of file StatisticsVector.h.

References StatisticsVector< T >::nTimeAverageReset.

236 {nTimeAverageReset=new_;}
int nTimeAverageReset
Determines after how many timesteps the time average is reset.
template<StatType T>
void StatisticsVector< T >::set_tintStat ( Mdouble  t)
inline

Definition at line 87 of file StatisticsVector.h.

References MD::t, and StatisticsVector< T >::tintStat.

87 {tintStat=t;};
Mdouble tintStat
Statistical output will only be created if tmaxStat-tintStat< t< tmaxStat.
Mdouble t
This stores the current time.
Definition: MD.h:687
template<StatType T>
void StatisticsVector< T >::set_tmaxStat ( Mdouble  t)
inline

Definition at line 86 of file StatisticsVector.h.

References MD::t, and StatisticsVector< T >::tmaxStat.

86 {tmaxStat=t;};
Mdouble tmaxStat
Statistical output will only be created if t
Mdouble t
This stores the current time.
Definition: MD.h:687
template<StatType T>
void StatisticsVector< T >::set_tminStat ( Mdouble  t)
inline

Definition at line 85 of file StatisticsVector.h.

References MD::t, and StatisticsVector< T >::tminStat.

85 {tminStat=t;};
Mdouble tminStat
Statistical output will only be created if t>tminStat.
Mdouble t
This stores the current time.
Definition: MD.h:687
template<StatType T>
void StatisticsVector< T >::set_verbosity ( int  new_)
inline

Definition at line 153 of file StatisticsVector.h.

References StatisticsVector< T >::verbosity.

153 {verbosity = new_;};
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
template<StatType T>
void StatisticsVector< T >::set_w ( Mdouble  w)
inline

Set CG variables w2 and CG_invvolume.

Definition at line 101 of file StatisticsVector.h.

References StatisticsVector< T >::set_w2(), and sqr.

101 {set_w2(sqr(w));};
#define sqr(a)
Definition: ExtendedMath.h:36
void set_w2(Mdouble new_)
Set CG variables w2 and CG_invvolume.
template<StatType T>
void StatisticsVector< T >::set_w2 ( Mdouble  new_)

Set CG variables w2 and CG_invvolume.

Todo:
{a default cutoff of 4.0 would be nicer}

Definition at line 46 of file StatisticsVector.hcc.

References Gaussian, HeavisideSphere, Polynomial, and sqr.

Referenced by StatisticsVector< T >::initialize_statistics(), and StatisticsVector< T >::set_w().

46  {
47  // set w2
48  if (new_>0.0) w2 = new_;
49  else w2 = sqr(w_over_rmax*getLargestParticle()->get_Radius());
50  //(2.0*get_xmax()/nx);
51 
52  // set cutoff radius
54  cutoff = sqrt(w2);
55  } else if (get_CG_type()==Gaussian) {
56  if (get_superexact()) cutoff = 5.0*sqrt(w2);
57  else cutoff = 3.0*sqrt(w2);
59  } else { std::cerr << "error in CG_function" << std::endl; exit(-1); }
60 }
Mdouble w_over_rmax
if w is not set manually then w will be set by multiplying this value by the largest particle radius ...
Mdouble cutoff
The distance from the origin at which the cg function vanishes; cutoff=w for HeavisideSphere or Polyn...
#define sqr(a)
Definition: ExtendedMath.h:36
Mdouble w2
coarse graining width squared; for HeavisideSphere and Gaussian
virtual BaseParticle * getLargestParticle()
Definition: MD.h:419
template<StatType T>
void StatisticsVector< T >::set_w_over_rmax ( Mdouble  new_)
inline

Definition at line 162 of file StatisticsVector.h.

References StatisticsVector< T >::w_over_rmax.

162 {w_over_rmax = new_;};
Mdouble w_over_rmax
if w is not set manually then w will be set by multiplying this value by the largest particle radius ...
template<StatType T>
void StatisticsVector< T >::set_walls ( bool  new_)
inline

Definition at line 156 of file StatisticsVector.h.

References StatisticsVector< T >::walls.

156 {walls = new_;};
bool walls
Turns off walls before evaluation.
template<StatType T>
void StatisticsVector< T >::set_xmaxStat ( Mdouble  xmaxStat_)
inline

Definition at line 209 of file StatisticsVector.h.

References StatisticsVector< T >::xmaxStat.

209 {xmaxStat=xmaxStat_;};
template<StatType T>
void StatisticsVector< T >::set_xminStat ( Mdouble  xminStat_)
inline

Definition at line 206 of file StatisticsVector.h.

References StatisticsVector< T >::xminStat.

206 {xminStat=xminStat_;};
Mdouble xminStat
By default the points of evaluation are placed in an grid on the domain [xminStat,xmaxStat]x[yminStat,ymaxStat]x[zminStat,zmaxStat].
template<StatType T>
void StatisticsVector< T >::set_ymaxStat ( Mdouble  ymaxStat_)
inline

Definition at line 210 of file StatisticsVector.h.

References StatisticsVector< T >::ymaxStat.

210 {ymaxStat=ymaxStat_;};
template<StatType T>
void StatisticsVector< T >::set_yminStat ( Mdouble  yminStat_)
inline

Definition at line 207 of file StatisticsVector.h.

References StatisticsVector< T >::yminStat.

207 {yminStat=yminStat_;};
template<StatType T>
void StatisticsVector< T >::set_zmaxStat ( Mdouble  zmaxStat_)
inline

Definition at line 211 of file StatisticsVector.h.

References StatisticsVector< T >::zmaxStat.

211 {zmaxStat=zmaxStat_;};
template<StatType T>
void StatisticsVector< T >::set_zminStat ( Mdouble  zminStat_)
inline

Definition at line 208 of file StatisticsVector.h.

References StatisticsVector< T >::zminStat.

208 {zminStat=zminStat_;};
template<StatType T>
Mdouble StatisticsVector< T >::setInfinitelyLongDistance ( )
template<>
Mdouble StatisticsVector< RAZ >::setInfinitelyLongDistance ( )

todo{check}

Definition at line 1981 of file StatisticsVector.hcc.

1981  {
1983  return std::min(std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
1984  std::max((get_xmaxStat()-P2.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P2.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X)),
1985  std::max((get_ymaxStat()-P2.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P2.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y));
1986 }
Mdouble X
Definition: Vector.h:44
Vec3D P2
Position of second contact point.
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Y
Definition: Vector.h:44
Mdouble Z
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< RA >::setInfinitelyLongDistance ( )

Definition at line 1987 of file StatisticsVector.hcc.

1987  {
1988  return std::min(std::max((get_ymaxStat()-P2.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P2.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y),
1989  std::max((get_xmaxStat()-P2.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P2.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X));
1990 }
Mdouble X
Definition: Vector.h:44
Vec3D P2
Position of second contact point.
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Y
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< RZ >::setInfinitelyLongDistance ( )

Definition at line 1991 of file StatisticsVector.hcc.

1991  {
1992  return std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
1993  std::max((get_xmaxStat()-P2.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P2.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X));
1994 }
Mdouble X
Definition: Vector.h:44
Vec3D P2
Position of second contact point.
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Z
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< AZ >::setInfinitelyLongDistance ( )

Definition at line 1995 of file StatisticsVector.hcc.

1995  {
1996  return std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
1997  std::max((get_ymaxStat()-P2.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P2.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y));
1998 }
Vec3D P2
Position of second contact point.
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Y
Definition: Vector.h:44
Mdouble Z
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< R >::setInfinitelyLongDistance ( )

Definition at line 1999 of file StatisticsVector.hcc.

1999  {
2000  return std::max((get_xmaxStat()-P2.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P2.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X);
2001 }
Mdouble X
Definition: Vector.h:44
Vec3D P2
Position of second contact point.
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Vec3D P1_P2_normal
Direction of contact.
template<>
Mdouble StatisticsVector< A >::setInfinitelyLongDistance ( )

Definition at line 2002 of file StatisticsVector.hcc.

2002  {
2003  return std::max((get_ymaxStat()-P2.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P2.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y);
2004 }
Vec3D P2
Position of second contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Y
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< XYZ >::setInfinitelyLongDistance ( )

Definition at line 2007 of file StatisticsVector.hcc.

2007  {
2008  return std::min(std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
2009  std::max((get_xmaxStat()-P1.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P1.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X)),
2010  std::max((get_ymaxStat()-P1.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P1.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y));
2011 }
Mdouble X
Definition: Vector.h:44
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Y
Definition: Vector.h:44
Mdouble Z
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< XY >::setInfinitelyLongDistance ( )

Definition at line 2012 of file StatisticsVector.hcc.

2012  {
2013  return std::min(std::max((get_ymaxStat()-P1.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P1.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y),
2014  std::max((get_xmaxStat()-P1.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P1.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X));
2015 }
Mdouble X
Definition: Vector.h:44
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Y
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< XZ >::setInfinitelyLongDistance ( )

Definition at line 2016 of file StatisticsVector.hcc.

2016  {
2017  return std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
2018  std::max((get_xmaxStat()-P1.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P1.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X));
2019 }
Mdouble X
Definition: Vector.h:44
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Z
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< YZ >::setInfinitelyLongDistance ( )

Definition at line 2020 of file StatisticsVector.hcc.

2020  {
2021  return std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
2022  std::max((get_ymaxStat()-P1.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P1.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y));
2023 }
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Y
Definition: Vector.h:44
Mdouble Z
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< X >::setInfinitelyLongDistance ( )

Definition at line 2024 of file StatisticsVector.hcc.

2024  {
2025  return std::max((get_xmaxStat()-P1.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P1.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X);
2026 }
Mdouble X
Definition: Vector.h:44
Mdouble get_xminStat()
Functions to acces and change the domain of statistics.
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
template<>
Mdouble StatisticsVector< Y >::setInfinitelyLongDistance ( )

Definition at line 2027 of file StatisticsVector.hcc.

2027  {
2028  return std::max((get_ymaxStat()-P1.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P1.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y);
2029 }
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Y
Definition: Vector.h:44
template<>
Mdouble StatisticsVector< Z >::setInfinitelyLongDistance ( )

Definition at line 2030 of file StatisticsVector.hcc.

2030  {
2031  return fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z);
2032 }
Vec3D P1
Position of first contact point.
Vec3D P1_P2_normal
Direction of contact.
Mdouble Z
Definition: Vector.h:44
template<>
double StatisticsVector< O >::setInfinitelyLongDistance ( )

Definition at line 2033 of file StatisticsVector.hcc.

2033  {
2034  return 0;
2035 }
template<StatType T>
void StatisticsVector< T >::statistics_from_fstat_and_data ( )

get StatisticsPoint

Todo:
{the ignore-periodic-walls should be automated for averaged dimensions}

Definition at line 860 of file StatisticsVector.hcc.

References MD::print().

Referenced by Statistics().

861 {
862  //This opens the file the data will be recalled from
864  open_data_file(std::fstream::in);
865 
866  //load first set of timesteps to obtain xdim, ydim, zdim
867 
868  //try to read data files; if data.0000 does not exist, try the next, up to .9999
869  for (int i=1; i<10000; i++) {
870  if(read_next_from_data_file(format)) break;
871  set_file_counter(i);
872  }
873 
874  //set tminstat to smallest time evaluated
875  if (get_t()>=get_tminStat()) set_tminStat(get_t()-get_dt());
876 
877  //This opens the file the force data will be recalled from
879  open_fstat_file(std::fstream::in);
880 
881  //This creates the file statistics will be saved to
882  //open_stat_file(std::fstream::out);
883 
884  if (verbosity>1) {
885  std::cout << "Input from " << get_data_filename() << std::endl;
886  std::cout << "Input from " << get_fstat_filename() << std::endl;
887  std::cout << "Output to " << get_stat_filename() << std::endl << std::endl;
888  }
889 
891 
892  //std::couts collision time
893  Mdouble mass = get_Mass_from_Radius(getLargestParticle()->get_Radius());
894  if (verbosity>1) std::cout << "Collision Time " << get_collision_time(mass)
895  << " and restitution coefficient " << get_restitution_coefficient(mass)
896  << " for mass " << mass << std::endl
897  << std::endl;
898  //std::couts particles
899  if (verbosity>2) {MD::print(std::cout,true); std::cout << std::endl;}
900  else if (verbosity) {MD::print(std::cout); std::cout << std::endl;}
901 
902  //this increases the file counter
903  if (get_options_data()==2 && get_t()<get_tminStat()) {
905  else find_next_data_file(get_tminStat(), false);
906  for(int i=1;i<get_file_counter();i++) jump_fstat();
907 
908  }
909 
910  //Output statistics for each time step
911  std::cout<<"Start statistics"<<std::endl;
912  do {
913  if (get_t()>get_tmaxStat()) {
914  std::cout << "reached end t="<<std::setprecision (9) <<get_t()<<" tmaxStat=" << std::setprecision (9) <<get_tmaxStat()<< std::endl; break;
915  } else if (get_t()>=get_tminStat()) {
916  if (verbosity>1) std::cout << "Get statistics for t=" << std::setprecision (9) << get_t() << std::endl;
917  else if (verbosity) std::cout << "Get statistics for t=" << std::setprecision (9) << get_t() << " \r";
918  if (verbosity>1) std::cout << "#particles="<< getParticleHandler().getNumberOfObjects() << std::endl;
919 
920  if (!walls) getWallHandler().clear();
923 
926  process_statistics(true);
927 
928  } else {
929  if (verbosity>1) std::cout<<"Jumping statistics t="<<get_t()<<" tminStat()="<<get_tminStat()<<std::endl;
930  jump_fstat();
931  }
932  //if step size>1, skip a number of steps.
933  if (get_options_data()!=2) for (unsigned int i=1; i<get_step_size(); i++) {
934  //you only get here if you change the step size and you use a single data file
936  jump_fstat();
937  }
938  } while (read_next_from_data_file(format));
939  //set tmax to largest time evaluated
940  if (get_t()<get_tmaxStat()) set_tmaxStat(get_t());
941 
943  get_data_file().close();
944  get_fstat_file().close();
945 }
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
bool read_next_from_data_file(unsigned int format)
bool find_next_data_file(Mdouble tmin, bool verbose=true)
Definition: MD.cc:426
void initialize_statistics()
Initializes statistics, i.e. setting w2, setting the grid and writing the header lines in the ...
void gather_force_statistics_from_fstat_and_data()
get force statistics from particle collisions
void output_statistics()
Calculates statistics for Particles (i.e. not collisions)
void finish_statistics()
Finish all statistics (i.e. write out final data)
Mdouble get_tminStat()
bool open_fstat_file(std::fstream::openmode mode=std::fstream::out)
Definition: STD_save.h:184
bool walls
Turns off walls before evaluation.
int get_file_counter()
Definition: STD_save.h:234
unsigned int get_step_size()
Definition: STD_save.h:155
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
void set_fstat_filename()
Definition: STD_save.h:143
std::string get_fstat_filename()
Definition: STD_save.h:148
virtual BaseParticle * getLargestParticle()
Definition: MD.h:419
Mdouble get_Mass_from_Radius(Mdouble radius, int indSpecies=0)
Definition: MD.h:407
void set_data_filename()
Definition: STD_save.h:144
void set_tmaxStat(Mdouble t)
Mdouble get_restitution_coefficient(Mdouble mass, unsigned int indSpecies=0)
Calculates restitution coefficient for two copies of given disp, k, mass.
Definition: MD.h:302
std::fstream & get_data_file()
Allows the problem_name to be accessed.
Definition: STD_save.h:130
void set_tminStat(Mdouble t)
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
WallHandler & getWallHandler()
Definition: MD.h:148
unsigned int get_options_data(void)
Definition: STD_save.h:162
double Mdouble
Definition: ExtendedMath.h:33
Mdouble get_tmaxStat()
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
std::fstream & get_fstat_file()
Allows the problem_name to be accessed.
Definition: STD_save.h:134
void process_statistics(bool usethese)
Processes all gathered statistics and resets them afterwards. (Processing means either calculating ti...
bool open_data_file(std::fstream::openmode mode=std::fstream::out)
Definition: STD_save.h:187
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
void set_file_counter(int new_)
Definition: STD_save.h:233
std::string get_stat_filename()
Definition: STD_save.h:150
std::string get_data_filename()
Definition: STD_save.h:149
BoundaryHandler & getBoundaryHandler()
Definition: MD.h:149
ParticleHandler & getParticleHandler()
Definition: MD.h:147
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
virtual void print(std::ostream &os, bool print_all=false)
Outputs MD.
Definition: MD.cc:1806
template<StatType T>
void StatisticsVector< T >::statistics_from_p3 ( )

this is a modified version of statistics_from_fstat_and_data. It is used to read p3d files

Todo:
{the ignore-periodic-walls should be automated for averaged dimensions}

Definition at line 1033 of file StatisticsVector.hcc.

References MD::create_xballs_script(), MD::output_xballs_data(), MD::print(), MD::save_restart_data(), MD::set_dim(), and MD::set_format().

1034 {
1035  //This opens the files the data will be recalled from
1036  std::string p3p_filename = problem_name.str().c_str(); p3p_filename += ".p3p";
1037  bool opened = open_file (p3p_file, p3p_filename, 1,std::fstream::in);
1038  std::string p3c_filename = problem_name.str().c_str(); p3c_filename += ".p3c";
1039  open_file (p3c_file, p3c_filename, 1,std::fstream::in);
1040  std::string p3w_filename = problem_name.str().c_str(); p3w_filename += ".p3w";
1041  open_file (p3w_file, p3w_filename, 1,std::fstream::in);
1042  int version=3;
1043  //If p3 is not available, open p4 files
1044  if (!opened) {
1045  std::cerr << "Warning could not open " << p3p_filename << std::endl;
1046  version=4;
1047  p3p_filename = problem_name.str().c_str(); p3p_filename += ".p4p";
1048  opened = open_file (p3p_file, p3p_filename, 1,std::fstream::in);
1049  p3c_filename = problem_name.str().c_str(); p3c_filename += ".p4c";
1050  opened = open_file (p3c_file, p3c_filename, 1,std::fstream::in);
1051  p3w_filename = problem_name.str().c_str(); p3w_filename += ".p4w";
1052  opened = open_file (p3w_file, p3w_filename, 1,std::fstream::in);
1053  if (!opened) {
1054  std::cerr << "could not open " << p3p_filename << std::endl;
1055  exit(-1);
1056  }
1057  }
1058  std::cout << "opened " << p3p_filename << std::endl;
1059 
1060  //load first set of timesteps to obtain xdim, ydim, zdim
1061 
1062  //try to read data files; if data.0000 does not exist, try the next, up to .9999
1064 
1065  //set tminstat to smallest time evaluated
1066  if (get_t()>=get_tminStat()) set_tminStat(get_t()-get_dt());
1068 
1070  open_data_file(std::fstream::out);
1071  MD::set_format(14);
1072  MD::set_dim(3);
1073  Species[0].set_dim_particle(3);
1076  //exit(-1);
1077 
1078  //This creates the file statistics will be saved to
1079  //open_stat_file(std::fstream::out);
1080 
1082 
1083  //std::couts collision time
1084  Mdouble mass = get_Mass_from_Radius(getLargestParticle()->get_Radius());
1085  if (verbosity>1) std::cout << "Collision Time " << get_collision_time(mass)
1086  << " and restitution coefficient " << get_restitution_coefficient(mass)
1087  << " for mass " << mass << std::endl
1088  << std::endl;
1089  //std::couts particles
1090  if (verbosity>2) {MD::print(std::cout,true); std::cout << std::endl;}
1091  else if (verbosity) {MD::print(std::cout); std::cout << std::endl;}
1092 
1093  //Output statistics for each time step
1094  std::cout<<"Start statistics"<<std::endl;
1095  do {
1096  if (get_t()>get_tmaxStat()) {
1097  std::cout << "reached end t="<<std::setprecision (9) <<get_t() <<" tmaxStat=" << std::setprecision (9) <<get_tmaxStat()<< std::endl;
1098  break;
1099  } else if (get_t()>=get_tminStat()) {
1100  if (verbosity>1) std::cout << "Get statistics for t=" << std::setprecision (9) << get_t() << std::endl;
1101  else if (verbosity) std::cout << "Get statistics for t=" << std::setprecision (9) << get_t() << " \r";
1102  if (verbosity>1) std::cout << "#particles="<< getParticleHandler().getNumberOfObjects() << std::endl;
1103 
1104  if (!walls) getWallHandler().clear();
1107 
1110  process_statistics(true);
1111 
1112  } else {
1113  if (verbosity>1) std::cout
1114  << "Jumping statistics t=" << get_t()
1115  << " tminStat()=" << get_tminStat() << std::endl;
1116  jump_p3c();
1117  }
1118  //if step size>1, skip a number of steps.
1119  for (unsigned int i=1; i<get_step_size(); i++) {
1120  //you only get here if you change the step size and you use a single data file
1122  jump_p3c();
1123  }
1124  } while (read_next_from_p3p_file());
1125  //set tmax to largest time evaluated
1126  if (get_t()<get_tmaxStat()) set_tmaxStat(get_t());
1127 
1129  p3p_file.close();
1130  p3c_file.close();
1131  p3w_file.close();
1132 }
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
void initialize_statistics()
Initializes statistics, i.e. setting w2, setting the grid and writing the header lines in the ...
void output_statistics()
Calculates statistics for Particles (i.e. not collisions)
void finish_statistics()
Finish all statistics (i.e. write out final data)
Mdouble get_tminStat()
bool open_file(std::fstream &file, std::string filename, unsigned int options, std::fstream::openmode mode)
Definition: STD_save.h:174
bool walls
Turns off walls before evaluation.
unsigned int get_step_size()
Definition: STD_save.h:155
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
std::fstream p3p_file
virtual BaseParticle * getLargestParticle()
Definition: MD.h:419
std::fstream p3w_file
void jump_p3c()
get force statistics from particle collisions
Mdouble get_Mass_from_Radius(Mdouble radius, int indSpecies=0)
Definition: MD.h:407
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
void set_tmaxStat(Mdouble t)
Mdouble get_restitution_coefficient(Mdouble mass, unsigned int indSpecies=0)
Calculates restitution coefficient for two copies of given disp, k, mass.
Definition: MD.h:302
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
void set_tminStat(Mdouble t)
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
WallHandler & getWallHandler()
Definition: MD.h:148
double Mdouble
Definition: ExtendedMath.h:33
Mdouble get_tmaxStat()
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 set_format(int new_)
Definition: MD.h:507
void process_statistics(bool usethese)
Processes all gathered statistics and resets them afterwards. (Processing means either calculating ti...
bool open_data_file(std::fstream::openmode mode=std::fstream::out)
Definition: STD_save.h:187
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
std::fstream p3c_file
virtual void output_xballs_data()
Output xball data for Particle i.
Definition: MD.cc:209
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
BoundaryHandler & getBoundaryHandler()
Definition: MD.h:149
ParticleHandler & getParticleHandler()
Definition: MD.h:147
void set_dim(int new_dim)
Allows the dimension of the simulation to be changed.
Definition: MD.h:367
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
virtual void print(std::ostream &os, bool print_all=false)
Outputs MD.
Definition: MD.cc:1806
void gather_force_statistics_from_p3c(int version)
get force statistics from particle collisions
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
template<StatType T>
void StatisticsVector< T >::verbose ( )
inline

Definition at line 152 of file StatisticsVector.h.

References StatisticsVector< T >::verbosity.

152 {verbosity = 2;};
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
template<StatType T>
void StatisticsVector< T >::write_statistics ( )

Writes regular statistics.

Definition at line 705 of file StatisticsVector.hcc.

706 {
707  std::cout << "writing statistics for t=" << get_t() << std::endl;
708 
709  // write to .stat file
710  get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_t() << std::endl;
711  for (unsigned int i=0; i<Points.size(); i++)
712  get_stat_file() << Points[i];
713  if (get_doGradient())
714  {
715  get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_t() << std::endl;
716  for (unsigned int i=0; i<dx.size(); i++)
717  get_stat_file() << dx[i];
718  get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_t() << std::endl;
719  for (unsigned int i=0; i<dy.size(); i++)
720  get_stat_file() << dy[i];
721  get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_t() << std::endl;
722  for (unsigned int i=0; i<dz.size(); i++)
723  get_stat_file() << dz[i];
724  }
725 
726 }
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
std::vector< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
std::fstream & get_stat_file()
Allows the problem_name to be accessed.
Definition: STD_save.h:132
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
template<StatType T>
void StatisticsVector< T >::write_time_average_statistics ( )

Writes out time averaged statistics.

Definition at line 788 of file StatisticsVector.hcc.

References StatisticsPoint< T >::print().

789 {
790  static bool first = true;
791 
792  if (verbosity) std::cout << std::endl << "averaging " << nTimeAverage << " timesteps " << std::endl;
793  if(nTimeAverage==0)
794  {
795  fprintf(stderr, "\n\n\tERROR :: Can not do TimeAverage of 0 timesteps\n\n");
796  //exit(-1);
797  return;
798  }
799  if (first) {
800  std::cout << "first" << nTimeAverage << std::endl;
801  for (unsigned int i=0; i<timeAverage.size(); i++) {
802  timeAverage[i].firstTimeAverage(nTimeAverage);
803  if (get_doVariance()) {
804  timeVariance[i].firstTimeAverage(nTimeAverage);
805  timeVariance[i] -= timeAverage[i].getSquared();
806  }
807  if (get_doGradient()) {
808  dxTimeAverage[i].firstTimeAverage(nTimeAverage);
809  dyTimeAverage[i].firstTimeAverage(nTimeAverage);
810  dzTimeAverage[i].firstTimeAverage(nTimeAverage);
811  }
812  }
813  first=false;
814  } else {
815  std::cout << "next" << nTimeAverage << std::endl;
816  for (unsigned int i=0; i<timeAverage.size(); i++) {
818  if (get_doVariance()) {
820  timeVariance[i] -= timeAverage[i].getSquared();
821  }
822  if (get_doGradient()) {
826  }
827  }
828  }
829 
830  // write average to .stat file
831  get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() << " " << get_t() << std::endl;
832  for (unsigned int i=0; i<timeAverage.size(); i++) get_stat_file() << timeAverage[i];
833  // write to std::cout
835  std::cout << "Averages: " << avg.print() << std::endl;
836 
837  if (get_doVariance()) {
838  // write variance to .stat file
839  get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() << " " << get_t() << " " << std::endl;
840  for (unsigned int i=0; i<timeVariance.size(); i++)
841  get_stat_file() << timeVariance[i];
842  //StatisticsPoint<T> var = average(timeVariance);
843  } //end if (get_doVariance)
844 
845  if (get_doGradient()) {
846  // write variance to .stat file
847  get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() << " " << get_t() << " " << std::endl;
848  for (unsigned int i=0; i<timeAverage.size(); i++) get_stat_file() << dxTimeAverage[i];
849  get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() << " " << get_t() << " " << std::endl;
850  for (unsigned int i=0; i<timeAverage.size(); i++) get_stat_file() << dyTimeAverage[i];
851  get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() << " " << get_t() << " " << std::endl;
852  for (unsigned int i=0; i<timeAverage.size(); i++) get_stat_file() << dzTimeAverage[i];
853  }
854 
855  set_tminStat(get_t());
856 
857 }
StatisticsPoint< T > average(std::vector< StatisticsPoint< T > > &P)
Output average of statistical variables.
std::vector< StatisticsPoint< T > > dyTimeAverage
a vector used to sum up all statistical gradients in dy for time-averaging
Mdouble get_tminStat()
int nTimeAverage
A counter needed to average over time.
std::vector< StatisticsPoint< T > > dxTimeAverage
a vector used to sum up all statistical gradients in dx for time-averaging
std::vector< StatisticsPoint< T > > dzTimeAverage
a vector used to sum up all statistical gradients in dz for time-averaging
std::string print() const
Outputs statistical variables in human-readable format.
void set_tminStat(Mdouble t)
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
std::fstream & get_stat_file()
Allows the problem_name to be accessed.
Definition: STD_save.h:132
std::vector< StatisticsPoint< T > > timeVariance
a vector used to sum up the variance in time of all statistical values
This class stores statistical values for a given spatial position; to be used in combination with Sta...
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
std::vector< StatisticsPoint< T > > timeAverage
A vector used to sum up all statistical values in Points for time-averaging.

Member Data Documentation

template<StatType T>
CG StatisticsVector< T >::CG_type
protected

coarse graining type (Gaussian, Heaviside, Polynomial)

Definition at line 309 of file StatisticsVector.h.

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

template<StatType T>
Mdouble StatisticsVector< T >::cutoff
protected

The distance from the origin at which the cg function vanishes; cutoff=w for HeavisideSphere or Polynomial, 3*w for Gaussian.

Definition at line 317 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_cutoff(), StatisticsVector< T >::get_cutoff2(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
Mdouble StatisticsVector< T >::cutoff2
protected

Definition at line 317 of file StatisticsVector.h.

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

template<StatType T>
bool StatisticsVector< T >::doGradient
protected
template<StatType T>
bool StatisticsVector< T >::doTimeAverage
protected

Determines if output is averaged over time.

Definition at line 297 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_doTimeAverage(), StatisticsVector< T >::set_doTimeAverage(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
bool StatisticsVector< T >::doublePoints
protected
template<StatType T>
bool StatisticsVector< T >::doVariance
protected
template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::dx
protected

A vector that stores the gradient in x of all statistical variables at a given position.

Definition at line 279 of file StatisticsVector.h.

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

template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::dxTimeAverage
protected

a vector used to sum up all statistical gradients in dx for time-averaging

Definition at line 291 of file StatisticsVector.h.

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

template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::dy
protected

A vector that stores the gradient in y of all statistical variables at a given position.

Definition at line 281 of file StatisticsVector.h.

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

template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::dyTimeAverage
protected

a vector used to sum up all statistical gradients in dy for time-averaging

Definition at line 293 of file StatisticsVector.h.

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

template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::dz
protected

A vector that stores the gradient in z of all statistical variables at a given position.

Definition at line 283 of file StatisticsVector.h.

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

template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::dzTimeAverage
protected

a vector used to sum up all statistical gradients in dz for time-averaging

Definition at line 295 of file StatisticsVector.h.

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

template<StatType T>
int StatisticsVector< T >::format
protected

Definition at line 355 of file StatisticsVector.h.

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

template<StatType T>
Mdouble StatisticsVector< T >::hmax
protected

defines the maximum height of the particles for which statistics are extracted

Definition at line 337 of file StatisticsVector.h.

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

template<StatType T>
bool StatisticsVector< T >::ignoreFixedParticles
protected

Determines if fixed particles contribute to particle statistics (density, ...)

Definition at line 344 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_ignoreFixedParticles(), StatisticsVector< T >::set_ignoreFixedParticles(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
Mdouble StatisticsVector< T >::indSpecies
protected

defines the species for which statistics are extracted (-1 for all species)

Definition at line 330 of file StatisticsVector.h.

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

template<StatType T>
bool StatisticsVector< T >::isMDCLR
protected

Definition at line 358 of file StatisticsVector.h.

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

template<StatType T>
int StatisticsVector< T >::nTimeAverage
protected

A counter needed to average over time.

Definition at line 305 of file StatisticsVector.h.

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

template<StatType T>
int StatisticsVector< T >::nTimeAverageReset
protected

Determines after how many timesteps the time average is reset.

Definition at line 299 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_TimeAverageReset(), and StatisticsVector< T >::set_TimeAverageReset().

template<StatType T>
int StatisticsVector< T >::nx
protected
template<StatType T>
int StatisticsVector< T >::nxMirrored
protected

extension of grid size from mirrored points

Definition at line 273 of file StatisticsVector.h.

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

template<StatType T>
int StatisticsVector< T >::nyMirrored
protected

Definition at line 273 of file StatisticsVector.h.

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

template<StatType T>
int StatisticsVector< T >::nzMirrored
protected

Definition at line 273 of file StatisticsVector.h.

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

template<StatType T>
Vec3D StatisticsVector< T >::P1
protected

Position of first contact point.

Definition at line 370 of file StatisticsVector.h.

template<StatType T>
Vec3D StatisticsVector< T >::P1_P2_CollisionalHeatFlux
protected

not yet working

Definition at line 391 of file StatisticsVector.h.

template<StatType T>
Vec3D StatisticsVector< T >::P1_P2_Contact
protected

Definition at line 381 of file StatisticsVector.h.

template<StatType T>
Matrix3D StatisticsVector< T >::P1_P2_ContactCoupleStress
protected

Definition at line 380 of file StatisticsVector.h.

template<StatType T>
Mdouble StatisticsVector< T >::P1_P2_Dissipation
protected

not yet working

Definition at line 393 of file StatisticsVector.h.

template<StatType T>
Mdouble StatisticsVector< T >::P1_P2_distance
protected

Length of contact line.

Definition at line 376 of file StatisticsVector.h.

template<StatType T>
MatrixSymmetric3D StatisticsVector< T >::P1_P2_Fabric
protected

Fabric.

Definition at line 389 of file StatisticsVector.h.

template<StatType T>
Vec3D StatisticsVector< T >::P1_P2_normal
protected

Direction of contact.

Definition at line 374 of file StatisticsVector.h.

template<StatType T>
Matrix3D StatisticsVector< T >::P1_P2_NormalStress
protected

Contact stress from normal forces along the line of contact.

Definition at line 378 of file StatisticsVector.h.

template<StatType T>
Vec3D StatisticsVector< T >::P1_P2_NormalTraction
protected

Traction from normal forces at contact of flow with fixed particles or walls.

Definition at line 385 of file StatisticsVector.h.

template<StatType T>
Mdouble StatisticsVector< T >::P1_P2_Potential
protected

not yet working

Definition at line 395 of file StatisticsVector.h.

template<StatType T>
Matrix3D StatisticsVector< T >::P1_P2_TangentialStress
protected

Contact stress from tangential forces along the line of contact.

Definition at line 383 of file StatisticsVector.h.

template<StatType T>
Vec3D StatisticsVector< T >::P1_P2_TangentialTraction
protected

Traction from tangential forces at contact of flow with fixed particles or walls.

Definition at line 387 of file StatisticsVector.h.

template<StatType T>
Vec3D StatisticsVector< T >::P2
protected

Position of second contact point.

Definition at line 372 of file StatisticsVector.h.

template<StatType T>
std::fstream StatisticsVector< T >::p3c_file
protected

Definition at line 405 of file StatisticsVector.h.

template<StatType T>
std::fstream StatisticsVector< T >::p3p_file
protected

Definition at line 404 of file StatisticsVector.h.

template<StatType T>
std::fstream StatisticsVector< T >::p3w_file
protected

Definition at line 406 of file StatisticsVector.h.

template<StatType T>
bool StatisticsVector< T >::periodicWalls
protected

Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if particle is in domain)

Todo:
{Thomas: the case periodicWalls=true seems to mess up some statistics. Needs to be checked or removed}

Definition at line 342 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_periodicWalls(), StatisticsVector< T >::set_periodicWalls(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::Points
protected

A vector that stores the values of the statistical variables at a given position.

Definition at line 277 of file StatisticsVector.h.

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

template<StatType T>
Mdouble StatisticsVector< T >::rmax
protected

defines the maximum radius of the particles for which statistics are extracted

Definition at line 335 of file StatisticsVector.h.

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

template<StatType T>
Mdouble StatisticsVector< T >::rmin
protected

defines the minimum radius of the particles for which statistics are extracted

Todo:
Thomas: maybe this fixed condition should be replaced by a condition function, bool include_statistics_if()

Definition at line 333 of file StatisticsVector.h.

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

template<StatType T>
StatType StatisticsVector< T >::statType
protected

Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are averaged; f.e. StatType X is averaged over y and z.

Definition at line 262 of file StatisticsVector.h.

template<StatType T>
int StatisticsVector< T >::StressTypeForFixedParticles
protected

0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowing Particle COM (default) 2 Stress from fixed particles distributed between fixed and flowing Particle COM 3 Stress from fixed particles extends from flowing particle to infinity

Definition at line 349 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_StressTypeForFixedParticles(), StatisticsVector< T >::set_infiniteStressForFixedParticles(), StatisticsVector< T >::set_StressTypeForFixedParticles(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
bool StatisticsVector< T >::superexact
protected

If true, cutoff radius for Gaussian is set to 5*w (from 3*w)

Definition at line 360 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_superexact(), StatisticsVector< T >::set_superexact(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::timeAverage
protected

A vector used to sum up all statistical values in Points for time-averaging.

Definition at line 287 of file StatisticsVector.h.

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

template<StatType T>
std::vector<StatisticsPoint<T> > StatisticsVector< T >::timeVariance
protected

a vector used to sum up the variance in time of all statistical values

Definition at line 289 of file StatisticsVector.h.

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

template<StatType T>
Mdouble StatisticsVector< T >::tintStat
protected

Statistical output will only be created if tmaxStat-tintStat< t< tmaxStat.

Definition at line 328 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_tintStat(), StatisticsVector< T >::set_tintStat(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
Mdouble StatisticsVector< T >::tmaxStat
protected

Statistical output will only be created if t<tmaxStat.

Definition at line 326 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_tmaxStat(), StatisticsVector< T >::set_tmaxStat(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
Mdouble StatisticsVector< T >::tminStat
protected

Statistical output will only be created if t>tminStat.

Definition at line 324 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_tminStat(), StatisticsVector< T >::set_tminStat(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
std::vector<Vec3D> StatisticsVector< T >::VelocityProfile
protected

Definition at line 400 of file StatisticsVector.h.

template<StatType T>
Vec3D StatisticsVector< T >::VelocityProfile_D
protected

Definition at line 402 of file StatisticsVector.h.

template<StatType T>
Vec3D StatisticsVector< T >::VelocityProfile_Min
protected

Definition at line 401 of file StatisticsVector.h.

template<StatType T>
int StatisticsVector< T >::verbosity
protected

0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)

Definition at line 354 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_verbosity(), StatisticsVector< T >::set_verbosity(), StatisticsVector< T >::StatisticsVector(), and StatisticsVector< T >::verbose().

template<StatType T>
Mdouble StatisticsVector< T >::w2
protected

coarse graining width squared; for HeavisideSphere and Gaussian

Definition at line 315 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_w(), StatisticsVector< T >::get_w2(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
Mdouble StatisticsVector< T >::w_over_rmax
protected

if w is not set manually then w will be set by multiplying this value by the largest particle radius at t=0

Definition at line 319 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_w_over_rmax(), StatisticsVector< T >::set_w_over_rmax(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
bool StatisticsVector< T >::walls
protected

Turns off walls before evaluation.

Definition at line 339 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_walls(), StatisticsVector< T >::set_walls(), and StatisticsVector< T >::StatisticsVector().

template<StatType T>
Mdouble StatisticsVector< T >::xminStat
protected

By default the points of evaluation are placed in an grid on the domain [xminStat,xmaxStat]x[yminStat,ymaxStat]x[zminStat,zmaxStat].

By default the domain is set to the domain of the MD problem (indicated by setting the stat-domain values to nan), but can be resized.

Definition at line 271 of file StatisticsVector.h.

Referenced by StatisticsVector< T >::get_xminStat(), StatisticsVector< T >::set_xminStat(), and StatisticsVector< T >::StatisticsVector().


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