MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MD.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 //#define FOLLOWPARTICLE
27 //#define FPID 1
28 
29 #ifndef MD_H
30 #define MD_H
31 
32 //This is a header with some extra standard maths function and constants that are required by the code
33 #include "ExtendedMath.h"
34 
35 //The vector class contains a 3D vector class.
36 #include "Vector.h"
37 #include <string.h>
38 //This class defines the particle handler
39 #include "ParticleHandler.h"
42 //This class defines the wall handler
43 #include "WallHandler.h"
44 #include "BaseWall.h"
45 #include "InfiniteWall.h"
46 //This class defines the boundary handler
47 #include "BoundaryHandler.h"
48 #include "PeriodicBoundary.h"
49 //This class defines the species
50 #include "CSpecies.h"
51 
52 #ifdef ContactListHgrid
53  //This class defines the posibleContact lists
54  #include "PossibleContactList.h"
55 #endif
56 
57 //This is the class that defines the std_save routines
58 #include "STD_save.h"
59 //#include "time.h"
60 //#include "CMakeDefinitions.hpp"
61 
62 //This is only used to change the file permission of the xball script create, at some point this code may be moved from this file to a different file.
63 #include <sys/types.h>
64 #include <sys/stat.h>
65 
66 #include "RNG.h"
67 
70 class MD : public STD_save {
71 public:
73  void constructor();
74 
75  MD()
76  {
77  constructor();
78  #ifdef CONSTUCTOR_OUTPUT
79  std::cerr << "MD() finished"<<std::endl;
80  #endif
81  }
82 
83  MD(STD_save& other) : STD_save(other) {
84  constructor();
85  #ifdef CONSTUCTOR_OUTPUT
86  std::cerr << "MD(STD_save& other) finished " << std::endl;
87  #endif
88  }
89 
91  virtual ~MD() {};
92 
93  void info(){print(std::cout);}
94 
96  void solve();
97 
99  void solve(unsigned int argc, char *argv[]) {
100  readArguments(argc, argv);
101  solve();
102  };
103 
105  void solveWithMDCLR();
106 
108  Mdouble get_t(){return t;}
110  void set_t(Mdouble new_t){t=new_t;}
111 
112  //~ ///Allows the number of Species to be changed
113  //~ void set_NSpecies(int N){
114  //~ if (N>=0) {
115  //~ Species.resize(N);
116  //~ for (int i=0; i<N; i++) {
117  //~ Species[i].MixedSpecies.resize(i);
118  //~ std::cout << "S" << Species[i].MixedSpecies.size() << std::endl;
119  //~ }
120  //~ } else {std::cerr << "Error in set_NSpecies" << std::endl; exit(-1);}
121  //~ }
123  int get_NSpecies(){return Species.size();}
124 
126  std::vector<CSpecies>& get_Species(void){return Species;}
128  CSpecies* get_Species(int i) {return &Species[i];}
129 
131  CSpecies* get_MixedSpecies(int i, int j) {
132  if (i>j) return &Species[i].MixedSpecies[j];
133  else return &Species[j].MixedSpecies[i];
134  };
136  void set_MixedSpecies(int i, int j, CSpecies& S) {
137  if (i>j) Species[i].MixedSpecies[j] = S;
138  else Species[j].MixedSpecies[i] = S;
139  };
140 
142  void set_tmax(Mdouble new_tmax){if (new_tmax>=0){tmax=new_tmax;} else { std::cerr << "Error in set_tmax, new_tmax="<<new_tmax << std::endl; exit(-1); }}
144  Mdouble get_tmax(){return tmax;}
145 
146 
150 #ifdef ContactListHgrid
151  PossibleContactList& getPossibleContactList() { return possibleContactList;}
152 #endif
153 
155  void set_savecount (int new_){if (new_>0) {set_save_count_all(new_);} else {std::cerr << "Error in set_savecount (set_savecount("<<new_<<"))"<< std::endl; exit(-1);}}
156  void set_save_count_all (int new_){if (new_>0) {save_count_data =new_;save_count_ene =new_;save_count_stat =new_;save_count_fstat=new_;} else {std::cerr << "Error in set_save_count_all (set_save_count_all("<<new_<<"))"<< std::endl; exit(-1);}}
157  void set_save_count_data (int new_){if (new_>0) {save_count_data =new_;} else {std::cerr << "Error in set_save_count_data, (set_save_count_data ("<<new_<<"))"<< std::endl; exit(-1);}}
158  void set_save_count_ene (int new_){if (new_>0) {save_count_ene =new_;} else {std::cerr << "Error in set_save_count_ene, (set_save_count_ene ("<<new_<<"))"<< std::endl; exit(-1);}}
159  void set_save_count_stat (int new_){if (new_>0) {save_count_stat =new_;} else {std::cerr << "Error in set_save_count_stat, (set_save_count_stat ("<<new_<<"))"<< std::endl; exit(-1);}}
160  void set_save_count_fstat(int new_){if (new_>0) {save_count_fstat=new_;} else {std::cerr << "Error in set_save_count_fstat, (set_save_count_fstat("<<new_<<"))"<< std::endl; exit(-1);}}
168 
170  void set_do_stat_always (bool new_) {do_stat_always=new_;}
172  void set_number_of_saves_all (Mdouble N){if (dt) {set_save_count_all((N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000);} else {std::cerr << "Error in set_number_of_saves_all ; dt must be set"; exit(-1);} }
173  void set_number_of_saves_data (Mdouble N){if (dt) {save_count_data = (N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000; } else {std::cerr << "Error in set_number_of_saves_data ; dt must be set"; exit(-1);} }
174  void set_number_of_saves_ene (Mdouble N){if (dt) {save_count_ene = (N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000; } else {std::cerr << "Error in set_number_of_saves_ene ; dt must be set"; exit(-1);} }
175  void set_number_of_saves_stat (Mdouble N){if (dt) {save_count_stat = (N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000; } else {std::cerr << "Error in set_number_of_saves_stat ; dt must be set"; exit(-1);} }
176  void set_number_of_saves_fstat(Mdouble N){if (dt) {save_count_fstat = (N>1)?((int)ceil(tmax/dt/(N-1.0))):1000000; } else {std::cerr << "Error in set_number_of_saves_fstat; dt must be set"; exit(-1);} }
177 
179 
181  void set_plastic_k1_k2max_kc_depth(Mdouble k1_, Mdouble k2max_, Mdouble kc_, Mdouble depth_, unsigned int indSpecies = 0)
182  {if (indSpecies<Species.size()) {Species[indSpecies].set_plastic_k1_k2max_kc_depth(k1_, k2max_, kc_, depth_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
183  void set_k1(Mdouble new_, unsigned int indSpecies = 0)
184  {if (indSpecies<Species.size()) {Species[indSpecies].set_k1(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
185  void set_k2max(Mdouble new_, unsigned int indSpecies = 0)
186  {if (indSpecies<Species.size()) {Species[indSpecies].set_k2max(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
187  void set_kc(Mdouble new_, unsigned int indSpecies = 0)
188  {if (indSpecies<Species.size()) {Species[indSpecies].set_kc(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
189  void set_depth(Mdouble new_, unsigned int indSpecies = 0)
190  {if (indSpecies<Species.size()) {Species[indSpecies].set_depth(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
192  Mdouble get_k1(unsigned int indSpecies = 0)
193  {return Species[indSpecies].get_k1();}
194  Mdouble get_k2max(unsigned int indSpecies = 0)
195  {return Species[indSpecies].get_k2max();}
196  Mdouble get_kc(unsigned int indSpecies = 0)
197  {return Species[indSpecies].get_kc();}
198  Mdouble get_depth(unsigned int indSpecies = 0)
199  {return Species[indSpecies].get_depth();}
200  Mdouble get_plastic_dt(Mdouble mass, unsigned int indSpecies = 0)
201  {return Species[indSpecies].get_plastic_dt(mass);}
202 
204  void set_k(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_k(new_);} else {std::cerr << "Error in set_k: species does not exist"; exit(-1);} }
206  Mdouble get_k(int indSpecies = 0){return Species[indSpecies].get_k();}
208  void set_kt(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_kt(new_);} else {std::cerr << "Error in set_kt: species does not exist"; exit(-1);}}
210  Mdouble get_kt(int indSpecies = 0){return Species[indSpecies].get_kt();}
212  void set_krolling(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_krolling(new_);} else {std::cerr << "Error in set_krolling: species does not exist"; exit(-1);}}
214  Mdouble get_krolling(int indSpecies = 0){return Species[indSpecies].get_krolling();}
216  void set_ktorsion(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_ktorsion(new_);} else {std::cerr << "Error in set_ktorsion: species does not exist"; exit(-1);}}
218  Mdouble get_ktorsion(int indSpecies = 0){return Species[indSpecies].get_ktorsion();}
220  void set_rho(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_rho(new_);} else {std::cerr << "Error in set_rho: species does not exist"; exit(-1);}}
222  Mdouble get_rho(int indSpecies = 0){return Species[indSpecies].get_rho();}
224  void set_dispt(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_dispt(new_);} else {std::cerr << "Error in set_dispt: species does not exist"; exit(-1);}}
226  Mdouble get_dispt(unsigned int indSpecies = 0){return Species[indSpecies].get_dispt();}
228  void set_disprolling(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_disprolling(new_);} else {std::cerr << "Error in set_disprolling: species does not exist"; exit(-1);}}
230  Mdouble get_disprolling(unsigned int indSpecies = 0){return Species[indSpecies].get_disprolling();}
232  void set_disptorsion(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_disptorsion(new_);} else {std::cerr << "Error in set_disptorsion: species does not exist"; exit(-1);}}
234  Mdouble get_disptorsion(unsigned int indSpecies = 0){return Species[indSpecies].get_disptorsion();}
235 
237  void set_disp(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_dissipation(new_);} else {std::cerr << "Error in set_dissipation: species does not exist"; exit(-1);}}
239  Mdouble get_disp(unsigned int indSpecies = 0){return Species[indSpecies].get_dissipation();}
241  void set_dissipation(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_dissipation(new_);} else {std::cerr << "Error in set_dissipation: species does not exist"; exit(-1);}}
243  Mdouble get_dissipation(unsigned int indSpecies = 0){return Species[indSpecies].get_dissipation();}
245  void set_mu(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_mu(new_);} else {std::cerr << "Error in set_mu: species does not exist"; exit(-1);}}
247  Mdouble get_mu(unsigned int indSpecies = 0){return Species[indSpecies].get_mu();}
249  void set_murolling(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_murolling(new_);} else {std::cerr << "Error in set_murolling: species does not exist"; exit(-1);}}
251  Mdouble get_murolling(unsigned int indSpecies = 0){return Species[indSpecies].get_murolling();}
253  void set_mutorsion(Mdouble new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_mutorsion(new_);} else {std::cerr << "Error in set_mutorsion: species does not exist"; exit(-1);}}
255  Mdouble get_mutorsion(unsigned int indSpecies = 0){return Species[indSpecies].get_mutorsion();}
256 
257  void set_rotation(bool new_){rotation=new_;}
258  bool get_rotation(){return rotation;}
259 
261  void set_dim_particle(int new_, unsigned int indSpecies = 0){if (indSpecies<Species.size()) {Species[indSpecies].set_dim_particle(new_);} else {std::cerr << "Error in set_dim_particle: species does not exist"; exit(-1);}}
263  int get_dim_particle(unsigned int indSpecies = 0){return Species[indSpecies].get_dim_particle();}
270 
272  void set_k_and_restitution_coefficient(Mdouble k_, Mdouble eps, Mdouble mass, unsigned int indSpecies = 0){
273  if (indSpecies<Species.size()) {Species[indSpecies].set_k_and_restitution_coefficient(k_, eps, mass);} else {std::cerr << "Error in set_k_and_restitution_coefficient: species does not exist"; exit(-1);}
274  }
276  void set_collision_time_and_restitution_coefficient(Mdouble tc, Mdouble eps, Mdouble mass, unsigned int indSpecies = 0){
277  if (indSpecies<Species.size()) {Species[indSpecies].set_collision_time_and_restitution_coefficient(tc, eps, mass);} else {std::cerr << "Error in set_collision_time_and_restitution_coefficient: species does not exist"; exit(-1);}
278  }
279 
283  void set_collision_time_and_restitution_coefficient(Mdouble tc, Mdouble eps, Mdouble mass1, Mdouble mass2,unsigned int indSpecies =0)
284  {
285  if (indSpecies<Species.size()) {Species[indSpecies].set_collision_time_and_restitution_coefficient(tc, eps, mass1, mass2);} else {std::cerr << "Error in set_collision_time_and_restitution_coefficient: species does not exist"; exit(-1);}
286  }
287 
290  if (indSpecies<Species.size()) {Species[indSpecies].set_collision_time_and_normal_and_tangential_restitution_coefficient(tc, eps, beta, mass1, mass2);} else {std::cerr << "Error in set_collision_time_and_restitution_coefficient: species does not exist"; exit(-1);}
291  }
292 
295  if (indSpecies<Species.size()) {Species[indSpecies].set_collision_time_and_normal_and_tangential_restitution_coefficient_nodispt(tc, eps, beta, mass1, mass2);} else {std::cerr << "Error in set_collision_time_and_restitution_coefficient: species does not exist"; exit(-1);}
296 
297  }
298 
300  Mdouble get_collision_time(Mdouble mass, unsigned int indSpecies = 0){return Species[indSpecies].get_collision_time(mass);}
302  Mdouble get_restitution_coefficient(Mdouble mass, unsigned int indSpecies = 0){return Species[indSpecies].get_restitution_coefficient(mass);}
303 
305  Mdouble get_xmin(){return xmin;}
307  Mdouble get_xmax(){return xmax;}
309  Mdouble get_ymin(){return ymin;}
311  Mdouble get_ymax(){return ymax;}
313  Mdouble get_zmin(){return zmin;}
315  Mdouble get_zmax(){return zmax;}
316 
318  void set_xmin(Mdouble new_xmin){if (new_xmin<=xmax){xmin=new_xmin;} else { std::cerr << "Warning in set_xmin(" << new_xmin << "): xmax=" << xmax << std::endl; }}
319 
320  void set_ymin(Mdouble new_ymin){if (new_ymin<=ymax){ymin=new_ymin;} else { std::cerr << "Error in set_ymin(" << new_ymin << "): ymax=" << ymax << std::endl; exit(-1); }}
321 
323 
324  void set_zmin(Mdouble new_zmin){if (new_zmin<=zmax){zmin=new_zmin;} else { std::cerr << "Warning in set_zmin(" << new_zmin << "): zmax=" << zmax << std::endl; }}
325 
327 
328  void set_xmax(Mdouble new_xmax){if (new_xmax>=xmin){xmax=new_xmax;} else { std::cerr << "Error in set_xmax(" << new_xmax << "): xmin=" << xmin << std::endl; exit(-1); }}
330 
331  void set_ymax(Mdouble new_ymax){if (new_ymax>ymin){ymax=new_ymax;} else { std::cerr << "Warning in set_ymax(" << new_ymax << "): ymin=" << ymin << std::endl; }}
333 
334  void set_zmax(Mdouble new_zmax){if (new_zmax>ymin){zmax=new_zmax;} else { std::cerr << "Error in set_zmax(" << new_zmax << "): zmin=" << zmin << std::endl; exit(-1); }}
335 
337  void set_dt(Mdouble new_dt){if (dt>=0.0){dt=new_dt;} else { std::cerr << "Error in set_dt" << std::endl; exit(-1); }}
339  Mdouble get_dt(){return dt;}
340 
342  void set_name(const char* name){problem_name.str(""); problem_name << name;}
343 
345  void set_xballs_colour_mode(int new_cmode){xballs_cmode=new_cmode;}
346  void set_xballs_cmode(int new_cmode){xballs_cmode=new_cmode;}
348 
350  void set_xballs_vector_scale(double new_vscale){xballs_vscale=new_vscale;}
352 
354  void set_xballs_additional_arguments(std::string new_){xballs_additional_arguments=new_.c_str();}
356 
358  void set_xballs_scale(Mdouble new_scale){xballs_scale=new_scale;}
359  double get_xballs_scale(){return xballs_scale;}
360 
362  void set_gravity(Vec3D new_gravity){gravity = new_gravity;}
365 
367  void set_dim(int new_dim){ if (new_dim>=1 && new_dim<=3) dim = new_dim; else { std::cerr << "Error in set_dim" << std::endl; exit(-1); }}
369  int get_dim(){return dim;}
370 
374  void set_restart_version(int new_){restart_version=new_;}
375 
377  bool get_restarted(){return restarted;}
379 
382 
383  void set_restarted(bool new_){
384  restarted=new_;
385  set_append(new_);
386  }
387 
389  bool get_append(){return append;}
391  void set_append(bool new_){append=new_;}
392 
393 
397  void set_ene_ela(Mdouble new_){ene_ela=new_;}
399  void add_ene_ela(Mdouble new_){ene_ela+=new_;}
400 
402  void Remove_Particle(int IP);
403 
405  // Some statistical output that might be of interest when setting particles' parameters
406 
407  Mdouble get_Mass_from_Radius(Mdouble radius, int indSpecies=0) {
408  BaseParticle P;
409  P.set_Radius(radius);
410  P.set_IndSpecies(indSpecies);
412  return P.get_Mass();
413  }
414 
416  Mdouble get_maximum_velocity(BaseParticle &P){return Species[P.get_IndSpecies()].get_maximum_velocity(P.get_Radius(),P.get_Mass());}
417 
420  virtual void removeParticle(int iP)
421  {
422 #ifdef ContactListHgrid
423  possibleContactList.remove_ParticlePosibleContacts(particleHandler.getObject(iP));
424 #endif
427  }
428 
433  return P->get_Radius() * sqrt(Species[P->get_IndSpecies()].k/(.5*P->get_Mass()));
434  }
435 
437  void set_dt_by_mass(Mdouble mass){dt = .02 * get_collision_time(mass);}
438 
441  Mdouble mass = P.get_Mass();
442  dt = .02 * get_collision_time(mass);
443  if (Species[P.get_IndSpecies()].dispt) { dt = std::min(dt,0.125*mass/Species[P.get_IndSpecies()].dispt); std::cerr << "Warning: dispt is large, dt had to be lowered"; }
444  }
445 
447  void set_dt(){
453  }
454 
457  virtual void setup_particles_initial_conditions();
458 
460  virtual void create_xballs_script();
461 
463  virtual double getInfo(BaseParticle& P) {return P.get_Species();}
464 
466  virtual void save_restart_data ();
467 
469  int load_restart_data ();
470  int load_restart_data (std::string filename);
471 
473  void statistics_from_restart_data(const char* name);
474 
476  virtual void write(std::ostream& os);
478  virtual void read(std::istream& is);
480  virtual void write_v1(std::ostream& os);
482  virtual void read_v1(std::istream& is);
483  virtual void read_v2(std::istream& is);
484 
486  bool load_from_data_file (const char* filename, unsigned int format=0);
488  bool load_par_ini_file (const char* filename);
489  bool read_next_from_data_file (unsigned int format=0);
491  bool find_next_data_file (Mdouble tmin, bool verbose=true);
492 
493 
495 
496  virtual void print(std::ostream& os, bool print_all=false);
497 
498  friend inline std::ostream& operator<<(std::ostream& os, MD &md) {
499  md.print(os);
500  return os;
501  }
502 
503  void add_Species(CSpecies& S);
504 
505  void add_Species(void) { add_Species(Species[0]); }
506 
507  void set_format(int new_) {format = new_;}
508  int get_format() {return format;}
509 
510  int readArguments(unsigned int argc, char *argv[]);
511 
512  virtual int readNextArgument(unsigned int& i, unsigned int argc, char *argv[]);
513 
514  //This is a random generator, often used by the initial conditions etc...
516 
517 //functions that should only be used in the class definitions
518 protected:
519 
521  virtual void compute_all_forces();
522 
524  virtual void compute_internal_forces(BaseParticle* i);
525 
528 
530  virtual void compute_internal_forces(BaseParticle* P1, BaseParticle* P2);
531 
534 
536  virtual void compute_external_forces(BaseParticle* PI);
537 
539  virtual void compute_walls(BaseParticle* PI);
540 
541  Mdouble computeShortRangeForceWithWall(BaseParticle* pI, int wall, CSpecies* pSpecies, Mdouble dist);
543 
545  virtual void actions_before_time_loop(){
547  //automatically sets dt if dt is not specified by the user
548  if (!dt) set_dt();
549  };
550 
553 
556 
561  virtual bool get_HGRID_UpdateEachTimeStep(){return true;};
562 
564  virtual void actions_before_time_step(){};
565 
567  virtual void actions_after_solve(){};
568 
570  virtual void actions_after_time_step(){};
571 
573  virtual void output_xballs_data();
574  virtual void output_xballs_data_particle(int i);
575 
577  virtual void start_ene();
578  virtual void fstat_header();
579  virtual void output_ene();
580 
582  virtual void initialize_statistics(){};
583  virtual void output_statistics(){};
584  virtual void gather_statistics_collision(int index1 UNUSED,int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED){};
585  virtual void process_statistics(bool usethese UNUSED){};
586  virtual void finish_statistics(){};
588 
591 
592  virtual void checkInteractionWithBoundaries();
593 
597 
600 
602  virtual void InitBroadPhase(){};
603 
605  virtual void broad_phase(BaseParticle* i)
606  {
607  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); (*it)!=i; ++it)
608  {
610  }
611  }
612 
613  void set_FixedParticles(unsigned int n){for (unsigned int i=0; i<std::min((unsigned int)particleHandler.getNumberOfObjects(),n); i++) particleHandler.getObject(i)->fixParticle();}
614 
616 
619 
621  virtual void cout_time() {
622  std::cout << "\rt=" << std::setprecision(3) << std::left << std::setw(6) << t
623  << ", tmax=" << std::setprecision(3) << std::left << std::setw(6) << tmax << " \r";
624  std::cout.flush();
625  #ifdef FOLLOWPARTICLE
626  std::cout<<std::endl;
627  #endif
628  }
629 
630  virtual bool continue_solve() {return true;}
631 
634  {
635  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it)
636  {
637  DeltaMaxsParticle* DMParticle=dynamic_cast<DeltaMaxsParticle*>(*it);
638  if(DMParticle)
639  DMParticle->get_DeltaMaxs().resize(0);
640  }
641  }
642 
645  {
646  for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it!=particleHandler.end(); ++it)
647  {
648  TangentialSpringParticle* TSParticle=dynamic_cast<TangentialSpringParticle*>(*it);
649  if(TSParticle)
650  TSParticle->get_TangentialSprings().resize(0);
651  }
652  }
653 
655  std::vector<CSpecies> Species;
656 
657 private:
658 
660  int dim;
661 
664 
666 
669 
673 
675  int save_count_data; //<determines how many time steps are skipped before the next data file is written
676  int save_count_ene; //<determines how many time steps are skipped before the next ene file is written
677  int save_count_stat; //<determines how many time steps are skipped before the next fstat file is written
678  int save_count_fstat;//<determines how many time steps are skipped before the next stat file is written
679  bool save_data_data;//<determines if the current timestep is written into the data file
680  bool save_data_ene;//<determines if the current timestep is written into the ene file
681  bool save_data_fstat;//<determines if the current timestep is written into the fstat file
682  bool save_data_stat;//<determines if the current timestep is written into the stat file
684 
685 
688 
690  Mdouble ene_ela; //<stores the potential energy in the elastic springs (global, because it has to be calculated in the force loop
691 
692 
693  //This is the private data that is only used by the xballs output
694 
695  int xballs_cmode; //< sets the xballs argument cmode (see xballs.txt)
696  Mdouble xballs_vscale; //< sets the xballs argument vscale (see xballs.txt)
697  Mdouble xballs_scale; //< sets the xballs argument scale (see xballs.txt)
698  std::string xballs_additional_arguments; //< std::string where additional xballs argument can be specified (see xballs.txt)
699  int format; //< sets the data file argument format (i.e. how many columns the data file has)
700  int restart_version; //<to read new and old restart data
701  bool restarted; //<to read new and old restart data
702  int data_FixedParticles; //<determines how many particles are fixed when reading in data files
703 
704 
705 private:
706 
710 #ifdef ContactListHgrid
711  PossibleContactList possibleContactList;
712 #endif
713 
718 
719 
720  bool append;
721  bool rotation;
724 };
725 
726 #endif
void set_number_of_saves(Mdouble N)
Definition: MD.h:171
int get_Species() const
std::vector< CSpecies > & get_Species(void)
Allows the species to be copied.
Definition: MD.h:126
bool save_data_fstat
Definition: MD.h:681
bool find_next_data_file(Mdouble tmin, bool verbose=true)
Definition: MD.cc:426
virtual void cout_time()
std::couts time
Definition: MD.h:621
BaseParticle * getLargestParticle() const
Gets a pointer to the largest BaseParticle (by interactionRadius) in this ParticleHandler.
void set_save_count_stat(int new_)
Definition: MD.h:159
CSpecies * get_Species(int i)
Allows the species to be accessed.
Definition: MD.h:128
Mdouble get_zmin()
Gets zmin.
Definition: MD.h:313
std::string xballs_additional_arguments
Definition: MD.h:698
virtual void setup_particles_initial_conditions()
This function allows the initial conditions of the particles to be set, by default locations is rando...
Definition: MD.cc:120
void set_ene_ela(Mdouble new_)
Sets ene_ela.
Definition: MD.h:397
void set_krolling(Mdouble new_, unsigned int indSpecies=0)
Allows the spring constant to be changed.
Definition: MD.h:212
Mdouble get_ktorsion(int indSpecies=0)
Allows the spring constant to be accessed.
Definition: MD.h:218
virtual void output_ene()
This function outputs statistical data - The default is to compute the rotational kinetic engergy...
Definition: MD.cc:175
Container to store all BaseBoundary.
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
Mdouble get_kc(unsigned int indSpecies=0)
Definition: MD.h:196
std::string get_xballs_additional_arguments()
Definition: MD.h:355
virtual ~MD()
Definition: MD.h:91
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.
Definition: MD.h:289
CTangentialSpring * getTangentialSpring(BaseParticle *PI, BaseParticle *PJ, BaseParticle *PJreal)
Definition: MD.cc:706
void set_MixedSpecies(int i, int j, CSpecies &S)
Allows the mixed species to be set.
Definition: MD.h:136
int format
Definition: MD.h:699
virtual void read_v1(std::istream &is)
Reads all MD data.
Definition: MD.cc:2217
Mdouble get_disprolling(unsigned int indSpecies=0)
Allows the tangential viscosity to be accessed.
Definition: MD.h:230
CSpecies * get_MixedSpecies(int i, int j)
Allows the mixed species to be accessed.
Definition: MD.h:131
int get_savecount()
Allows the number of time steps between saves to be accessed.
Definition: MD.h:162
Here are the rounties to use a counter file to store run numbers.
Definition: STD_save.h:48
void set_restarted(bool new_)
Definition: MD.h:383
bool load_par_ini_file(const char *filename)
allows the user to read par.ini files (useful to read MDCLR files)
Definition: MD.cc:271
Mdouble get_dispt(unsigned int indSpecies=0)
Allows the tangential viscosity to be accessed.
Definition: MD.h:226
void set_append(bool new_)
Sets restarted.
Definition: MD.h:391
void reset_DeltaMax()
sets the history parameter DeltaMax of all particles to zero
Definition: MD.h:633
Mdouble get_mutorsion(unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be accessed.
Definition: MD.h:255
Mdouble get_ene_ela()
Gets ene_ela.
Definition: MD.h:395
bool get_append()
Gets restarted.
Definition: MD.h:389
void compute_particle_mass(std::vector< CSpecies > &Species)
Compute Particle mass function, which required a reference to the Species vector. It copmuters the Pa...
virtual void start_ene()
Functions for ene file.
Definition: MD.cc:127
void add_ene_ela(Mdouble new_)
Sets ene_ela.
Definition: MD.h:399
int get_IndSpecies() const
Mdouble get_dt()
Allows the time step dt to be accessed.
Definition: MD.h:339
double get_xballs_vscale()
Definition: MD.h:351
virtual void HGRID_InsertParticleToHgrid(BaseParticle *obj UNUSED)
This is action before the time step is started.
Definition: MD.h:558
void set_xballs_cmode(int new_cmode)
Definition: MD.h:346
int read_dim_from_data_file()
Definition: MD.cc:628
bool restarted
Definition: MD.h:701
void solveWithMDCLR()
Tries to solve the problem using MDCLR.
void reset_TangentialSprings()
sets the history parameter TangentialSprings of all particles to zero
Definition: MD.h:644
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
T * getObject(const unsigned int id) const
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:176
void set_restart_version(int new_)
Sets restart_version.
Definition: MD.h:374
virtual void do_integration_after_force_computation(BaseParticle *pI)
This is were the integration is done.
Definition: MD.cc:1843
int save_restart_data_counter
Definition: MD.h:723
void set_xballs_scale(Mdouble new_scale)
Set the scale of the xballs problem. The default is fit to screen.
Definition: MD.h:358
Mdouble xballs_scale
Definition: MD.h:697
void set_dt()
Sets dt to 1/50-th of the smallest possible collision time.
Definition: MD.h:447
void set_savecount(int new_)
Allows the number of time steps between saves to be changed, see also set_number_of_saves.
Definition: MD.h:155
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
Mdouble get_k1(unsigned int indSpecies=0)
Allows the plastic constants to be accessed.
Definition: MD.h:192
virtual void HGRID_update_move(BaseParticle *, Mdouble)
Definition: MD.h:594
virtual void InitBroadPhase()
Initialisation of Broad Phase Information (Default no Broad Phase so empty)
Definition: MD.h:602
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
friend std::ostream & operator<<(std::ostream &os, MD &md)
Definition: MD.h:498
bool rotation
Definition: MD.h:721
virtual void actions_after_solve()
This is actions at the end of the code, but before the files are closed.
Definition: MD.h:567
int dim
The dimension of the simulation.
Definition: MD.h:660
virtual void broad_phase(BaseParticle *i)
Broad phase of contact detection goes here. Default check all contacts.
Definition: MD.h:605
void set_number_of_saves_ene(Mdouble N)
Definition: MD.h:174
bool do_stat_always
Definition: MD.h:683
virtual void compute_external_forces(BaseParticle *PI)
This is were the computation of external forces takes place (e.g. gravity)
Definition: MD.cc:1410
void set_xmin(Mdouble new_xmin)
Sets xmin and walls, assuming the standard definition of walls as in the default constructor.
Definition: MD.h:318
void set_tmax(Mdouble new_tmax)
Allows the upper time limit to be changed.
Definition: MD.h:142
void set_xballs_colour_mode(int new_cmode)
Set the xball output mode.
Definition: MD.h:345
virtual BaseParticle * getLargestParticle()
Definition: MD.h:419
Mdouble get_Mass_from_Radius(Mdouble radius, int indSpecies=0)
Definition: MD.h:407
int get_dim()
Allows the dimension of the simulation to be accessed.
Definition: MD.h:369
void Remove_Duplicate_Periodic_Particles()
Remove periodic duplicate Particles (i.e. removes particles created by Check_and_Duplicate_Periodic_P...
Definition: MD.cc:2703
void constructor()
A public constructor, which sets defaults so the problem can be solved off the shelf.
Definition: MD.cc:50
int readArguments(unsigned int argc, char *argv[])
Can interpret main function input arguments that are passed by the driver codes.
Definition: MD.cc:2535
std::vector< CSpecies > Species
These are the particle parameters like dissipation etc.
Definition: MD.h:655
Mdouble get_krolling(int indSpecies=0)
Allows the spring constant to be accessed.
Definition: MD.h:214
bool get_save_data_stat()
Definition: MD.h:268
Mdouble get_max_radius()
Sets restarted.
Definition: MD.h:381
CDeltaMaxs & get_DeltaMaxs()
virtual void write(std::ostream &os)
Writes all MD data.
Definition: MD.cc:1985
void solve()
The work horse of the code.
Definition: MD.cc:2266
virtual void HGRID_RemoveParticleFromHgrid(BaseParticle *obj UNUSED)
Definition: MD.h:560
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...
Definition: MD.h:276
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
Mdouble get_murolling(unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be accessed.
Definition: MD.h:251
Mdouble get_dissipation(unsigned int indSpecies=0)
Allows the normal dissipation to be accessed.
Definition: MD.h:243
void set_xballs_additional_arguments(std::string new_)
Set the additional arguments for xballs.
Definition: MD.h:354
CTangentialSprings & get_TangentialSprings()
int get_save_count_data()
Definition: MD.h:164
void set_murolling(Mdouble new_, unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be changed.
Definition: MD.h:249
void set_t(Mdouble new_t)
Access function for the time.
Definition: MD.h:110
bool get_save_data_fstat()
Definition: MD.h:267
RNG random
Definition: MD.h:515
void set_depth(Mdouble new_, unsigned int indSpecies=0)
Definition: MD.h:189
Mdouble get_ymax()
Gets ymax.
Definition: MD.h:311
Mdouble computeShortRangeForceWithParticle(BaseParticle *PI, BaseParticle *PJ, BaseParticle *PJreal, CSpecies *pSpecies, Mdouble dist)
Definition: MD.cc:1711
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...
Definition: MD.h:272
WallHandler wallHandler
Definition: MD.h:708
MD()
Definition: MD.h:75
std::stringstream problem_name
Stores the problem_name.
Definition: STD_save.h:242
virtual void save_restart_data()
Stores all MD data.
Definition: MD.cc:654
Mdouble get_Radius() const
virtual void gather_statistics_collision(int index1 UNUSED, int index2 UNUSED, Vec3D Contact UNUSED, Mdouble delta UNUSED, Mdouble ctheta UNUSED, Mdouble fdotn UNUSED, Mdouble fdott UNUSED, Vec3D P1_P2_normal_ UNUSED, Vec3D P1_P2_tangential UNUSED)
Definition: MD.h:584
virtual bool continue_solve()
Definition: MD.h:630
Mdouble get_Mass() const
int restart_version
Definition: MD.h:700
int xballs_cmode
Definition: MD.h:695
Mdouble get_maximum_velocity(BaseParticle &P)
Calculates the maximum velocity allowed for a collision of two copies of P (for higher velocities par...
Definition: MD.h:416
void set_dt(Mdouble new_dt)
Allows the time step dt to be changed.
Definition: MD.h:337
This is a class that generates random numbers i.e.
Definition: RNG.h:38
void compute_particle_masses()
Computes the mass of each particle.
Definition: MD.h:618
virtual void set_initial_pressures_for_pressure_controlled_walls()
Definition: MD.h:587
bool save_data_ene
Definition: MD.h:680
void set_save_count_fstat(int new_)
Definition: MD.h:160
void set_kt(Mdouble new_, unsigned int indSpecies=0)
Allows the spring constant to be changed.
Definition: MD.h:208
ParticleHandler particleHandler
Definition: MD.h:707
BoundaryHandler boundaryHandler
Definition: MD.h:709
Mdouble dt
These are numerical constants like the time step size.
Definition: MD.h:671
bool get_save_data_ene()
Definition: MD.h:266
virtual void output_xballs_data_particle(int i)
This function outputs the location and velocity of the particle in a format the xballs progream can r...
Definition: MD_xballs.icc:30
void set_number_of_saves_fstat(Mdouble N)
Definition: MD.h:176
virtual void process_statistics(bool usethese UNUSED)
Definition: MD.h:585
virtual void actions_after_time_step()
This is action after the time step is finished.
Definition: MD.h:570
virtual void do_integration_before_force_computation(BaseParticle *pI)
This is were the integration is done.
Definition: MD.cc:1773
Mdouble xmax
Definition: MD.h:668
Mdouble get_t()
Access function for the time.
Definition: MD.h:108
bool get_save_data_data()
Returns the data counter.
Definition: MD.h:265
WallHandler & getWallHandler()
Definition: MD.h:148
Mdouble get_ymin()
Gets ymin.
Definition: MD.h:309
BaseParticle * getSmallestParticle() const
Gets a pointer to the smallest BaseParticle (by interactionRadius) in this ParticleHandler.
virtual void actions_before_time_loop()
This is actions before the start of the main time loop.
Definition: MD.h:545
void statistics_from_restart_data(const char *name)
Loads all MD data and plots statistics for all timesteps in the .data file.
Definition: MD.cc:1890
bool get_restarted()
Gets restarted.
Definition: MD.h:377
virtual void fstat_header()
Definition: MD.cc:145
Mdouble max_radius
Definition: MD.h:665
void set_disptorsion(Mdouble new_, unsigned int indSpecies=0)
Allows the tangential viscosity to be changed.
Definition: MD.h:232
virtual void finish_statistics()
Definition: MD.h:586
bool get_rotation()
Definition: MD.h:258
Mdouble t
This stores the current time.
Definition: MD.h:687
int save_count_ene
Definition: MD.h:676
void set_k2max(Mdouble new_, unsigned int indSpecies=0)
Definition: MD.h:185
Mdouble zmax
Definition: MD.h:668
Mdouble get_xmin()
Get xmin.
Definition: MD.h:305
int get_save_count_ene()
Definition: MD.h:165
double Mdouble
Definition: ExtendedMath.h:33
Mdouble computeShortRangeForceWithWall(BaseParticle *pI, int wall, CSpecies *pSpecies, Mdouble dist)
Definition: MD.cc:1744
int get_xballs_cmode()
Definition: MD.h:347
void set_save_count_data(int new_)
Definition: MD.h:157
void set_IndSpecies(const int _new)
void info()
Set up a virtual info this will be provided from the inhertiance.
Definition: MD.h:93
virtual int readNextArgument(unsigned int &i, unsigned int argc, char *argv[])
Definition: MD.cc:2554
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 solve(unsigned int argc, char *argv[])
Read arguments before solving.
Definition: MD.h:99
void set_do_stat_always(bool new_)
Sets how often the data is saved using the number of saves wanted, tmax, and dt. See also set_savecou...
Definition: MD.h:170
void set_dim_particle(int new_, unsigned int indSpecies=0)
Allows the dimension of the particle (f.e. for mass) to be changed.
Definition: MD.h:261
virtual bool get_HGRID_UpdateEachTimeStep()
Definition: MD.h:561
virtual void HGRID_actions_after_integration()
Definition: MD.h:596
Mdouble get_k(int indSpecies=0)
Allows the spring constant to be accessed.
Definition: MD.h:206
bool append
Definition: MD.h:720
CTangentialSpring * getTangentialSpringWall(BaseParticle *pI, int w)
Definition: MD.cc:741
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
Mdouble get_rho(int indSpecies=0)
Allows the density to be accessed.
Definition: MD.h:222
void set_save_count_all(int new_)
Definition: MD.h:156
virtual void actions_before_time_step()
This is action before the time step is started.
Definition: MD.h:564
Stores the tangential spring needed to compute a tangential elastic force between particles PI...
virtual void initialize_statistics()
Functions for statistics.
Definition: MD.h:582
void set_mutorsion(Mdouble new_, unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be changed.
Definition: MD.h:253
Mdouble get_kt(int indSpecies=0)
Allows the spring constant to be accessed.
Definition: MD.h:210
void set_FixedParticles(unsigned int n)
Definition: MD.h:613
bool save_data_stat
Definition: MD.h:682
virtual void compute_all_forces()
This does the force computation.
Definition: MD.cc:1935
virtual void HGRID_UpdateParticleInHgrid(BaseParticle *obj UNUSED)
Definition: MD.h:559
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
void set_xballs_vector_scale(double new_vscale)
Set the scale of vectors in xballs.
Definition: MD.h:350
Mdouble get_tmax()
Allows the upper time limit to be accessed.
Definition: MD.h:144
void set_number_of_saves_data(Mdouble N)
Definition: MD.h:173
Mdouble get_depth(unsigned int indSpecies=0)
Definition: MD.h:198
void set_format(int new_)
Definition: MD.h:507
virtual void output_statistics()
Definition: MD.h:583
Mdouble get_disptorsion(unsigned int indSpecies=0)
Allows the tangential viscosity to be accessed.
Definition: MD.h:234
MD(STD_save &other)
Definition: MD.h:83
int PeriodicCreated
Definition: MD.h:722
virtual void write_v1(std::ostream &os)
Writes all MD data.
Definition: MD.cc:2198
void set_k1(Mdouble new_, unsigned int indSpecies=0)
Definition: MD.h:183
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
Definition: BaseHandler.h:199
void initialize_tangential_springs()
void set_mu(Mdouble new_, unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be changed.
Definition: MD.h:245
bool save_data_data
Definition: MD.h:679
int save_count_stat
Definition: MD.h:677
Mdouble get_maximum_velocity()
Definition: MD.h:431
int get_save_count()
Definition: MD.h:163
void set_number_of_saves_stat(Mdouble N)
Definition: MD.h:175
Container to store all BaseParticle.
Mdouble get_disp(unsigned int indSpecies=0)
Allows the normal dissipation to be accessed.
Definition: MD.h:239
void set_Radius(const Mdouble _new)
void set_rho(Mdouble new_, unsigned int indSpecies=0)
Allows the density to be changed.
Definition: MD.h:220
virtual void read(std::istream &is)
Reads all MD data.
Definition: MD.cc:2026
int get_format()
Definition: MD.h:508
Container to store all BaseWall.
Definition: WallHandler.h:36
void set_kc(Mdouble new_, unsigned int indSpecies=0)
Definition: MD.h:187
void add_Species(void)
Definition: MD.h:505
void set_dt(BaseParticle &P)
Sets dt to 1/50-th of the collision time for two copies of P.
Definition: MD.h:440
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.
Definition: MD.h:294
#define UNUSED
Definition: ExtendedMath.h:38
A class that defines and solves a MD problem.
Definition: MD.h:70
Mdouble get_plastic_dt(Mdouble mass, unsigned int indSpecies=0)
Definition: MD.h:200
virtual void HGRID_actions_before_integration()
Definition: MD.h:595
virtual void output_xballs_data()
Output xball data for Particle i.
Definition: MD.cc:209
double get_xballs_scale()
Definition: MD.h:359
Mdouble get_mu(unsigned int indSpecies=0)
Allows the Coulomb friction coefficient to be accessed.
Definition: MD.h:247
void set_name(const char *name)
Sets the name of the problem, used for the same data files.
Definition: MD.h:342
virtual void read_v2(std::istream &is)
Definition: MD.cc:2121
virtual void removeParticle(int iP)
Definition: MD.h:420
int load_restart_data()
Loads all MD data.
Definition: MD.cc:685
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.
Definition: MD.h:181
virtual void HGRID_actions_before_time_loop()
This is actions before the start of the main time loop.
Definition: MD.h:552
Vec3D gravity
Gravitational acceleration.
Definition: MD.h:663
BoundaryHandler & getBoundaryHandler()
Definition: MD.h:149
Mdouble ene_ela
used in force calculations
Definition: MD.h:690
void Remove_Particle(int IP)
This function removes partice IP from the vector of particles by moving the last particle in the vect...
void set_number_of_saves_all(Mdouble N)
Definition: MD.h:172
ParticleHandler & getParticleHandler()
Definition: MD.h:147
void set_ktorsion(Mdouble new_, unsigned int indSpecies=0)
Allows the spring constant to be changed.
Definition: MD.h:216
void compute_plastic_internal_forces(BaseParticle *P1, BaseParticle *P2)
Computes plastic forces between particles.
Definition: MD.cc:1139
Mdouble xballs_vscale
Definition: MD.h:696
void set_dissipation(Mdouble new_, unsigned int indSpecies=0)
Allows the normal dissipation to be changed.
Definition: MD.h:241
int save_count_fstat
Definition: MD.h:678
void set_dim(int new_dim)
Allows the dimension of the simulation to be changed.
Definition: MD.h:367
void set_dt_by_mass(Mdouble mass)
Sets dt to 1/50-th of the collision time for two particles of mass P.
Definition: MD.h:437
virtual void HGRID_actions_before_time_step()
This is action before the time step is started.
Definition: MD.h:555
Mdouble tmax
Definition: MD.h:672
int get_NSpecies()
Allows the number of Species to be accessed.
Definition: MD.h:123
int get_restart_version()
Gets restart_version.
Definition: MD.h:372
Mdouble get_xmax()
Get xmax.
Definition: MD.h:307
Mdouble xmin
These store the size of the domain, assume walls at the ends.
Definition: MD.h:668
Mdouble get_k2max(unsigned int indSpecies=0)
Definition: MD.h:194
virtual BaseParticle * getSmallestParticle()
Definition: MD.h:418
void set_gravity(Vec3D new_gravity)
Allows the gravitational acceleration to be changed.
Definition: MD.h:362
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
virtual void checkInteractionWithBoundaries()
Definition: MD.cc:1794
void set_disprolling(Mdouble new_, unsigned int indSpecies=0)
Allows the tangential viscosity to be changed.
Definition: MD.h:228
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
Vec3D get_gravity()
Allows the gravitational acceleration to be accessed.
Definition: MD.h:364
void set_rotation(bool new_)
Definition: MD.h:257
void set_ymin(Mdouble new_ymin)
Definition: MD.h:320
virtual double getInfo(BaseParticle &P)
Allows the user to set what is written into the info column in the data file. By default is store the...
Definition: MD.h:463
Stores properties of the particles and the contact models such as the elastic modulus.
Definition: CSpecies.h:56
virtual void removeObject(unsigned const int id)
Removes a Object from the BaseHandler.
Definition: BaseHandler.h:122
virtual void compute_walls(BaseParticle *PI)
This is were the walls are.
Definition: MD.cc:1423
void set_dispt(Mdouble new_, unsigned int indSpecies=0)
Allows the tangential viscosity to be changed.
Definition: MD.h:224
int save_count_data
These are informations for saving.
Definition: MD.h:675
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...
Definition: MD.h:283
int get_save_count_fstat()
Definition: MD.h:167
Mdouble ymin
Definition: MD.h:668
Mdouble get_zmax()
Gets zmax.
Definition: MD.h:315
void set_k(Mdouble new_, unsigned int indSpecies=0)
Allows the spring constant to be changed.
Definition: MD.h:204
int Check_and_Duplicate_Periodic_Particles()
Calls Check_and_Duplicate_Periodic_Particle for all Particles curently in Particles[] and returns the...
Definition: MD.cc:2719
int get_save_count_stat()
Definition: MD.h:166
virtual void compute_internal_forces(BaseParticle *i)
Computes the forces between particles (internal in the sence that the sum over all these forces is ze...
Definition: MD.cc:1980
Mdouble zmin
Definition: MD.h:668
Mdouble ymax
Definition: MD.h:668
void set_save_count_ene(int new_)
Definition: MD.h:158
virtual void print(std::ostream &os, bool print_all=false)
Outputs MD.
Definition: MD.cc:1806
void fixParticle()
Fix Particle function. It fixes a Particle by setting its inverse mass and inertia and velocities to ...
bool get_do_stat_always()
Definition: MD.h:269
int get_dim_particle(unsigned int indSpecies=0)
Allows the dimension of the particle (f.e. for mass) to be accessed.
Definition: MD.h:263
void set_disp(Mdouble new_, unsigned int indSpecies=0)
Allows the normal dissipation to be changed.
Definition: MD.h:237
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
int data_FixedParticles
Definition: MD.h:702
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