| 
    HG-MD
    1
    
   
   | 
  
  
  
 
Used by Chute::create_bottom to create an unordered particle layer. More...
#include <ChuteBottom.h>


Public Member Functions | |
| ChuteBottom () | |
| This is the default constructor. All it does is set sensible defaults.   | |
| ChuteBottom (MD &other) | |
| Copy-constructor for creates an HGRID problem from an existing MD problem.   | |
| ChuteBottom (HGRID_base &other) | |
| ChuteBottom (HGRID_3D &other) | |
| ChuteBottom (Chute &other) | |
| void | constructor () | 
| This is the actual constructor it is called do both constructors above.   | |
| void | make_rough_bottom (ParticleHandler &ChuteParticleHandler) | 
| void | setup_particles_initial_conditions () | 
| initialize particle position, velocity, radius   | |
| void | actions_before_time_step () | 
| This is action before the time step is started.   | |
| Mdouble | get_thickness () | 
| void | set_thickness (Mdouble new_) | 
| Mdouble | get_periodicbottom () | 
| void | set_periodicbottom (bool new_) | 
Private Attributes | |
| Mdouble | thickness | 
| bool | periodicbottom | 
Used by Chute::create_bottom to create an unordered particle layer.
It creates a thick layer of particles in a box of the same x and y dimensions as the Chute, and places a thin slice of that layer as fixed particles at the base of the chute.
| ChuteBottom::ChuteBottom | ( | ) |  [inline] | 
        
This is the default constructor. All it does is set sensible defaults.
References constructor().
{constructor();}
| ChuteBottom::ChuteBottom | ( | MD & | other | ) |  [inline] | 
        
Copy-constructor for creates an HGRID problem from an existing MD problem.
References constructor().
: MD(other), Chute(other) {constructor();}
| ChuteBottom::ChuteBottom | ( | HGRID_base & | other | ) |  [inline] | 
        
References constructor().
: MD(other), Chute(other) {constructor();}
| ChuteBottom::ChuteBottom | ( | HGRID_3D & | other | ) |  [inline] | 
        
References constructor().
: MD(other), Chute(other) {constructor();}
| ChuteBottom::ChuteBottom | ( | Chute & | other | ) |  [inline] | 
        
References constructor().
: MD(other), Chute(other) {constructor();}
| void ChuteBottom::actions_before_time_step | ( | ) |  [inline, virtual] | 
        
| void ChuteBottom::constructor | ( | ) |  [inline] | 
        
This is the actual constructor it is called do both constructors above.
Reimplemented from Chute.
References MD::set_name(), STD_save::set_options_data(), STD_save::set_options_fstat(), STD_save::set_options_restart(), set_periodicbottom(), and set_thickness().
Referenced by ChuteBottom().
                          {     
                set_name("roughbottom");
                set_options_fstat(0); //set to 0 for no data creation
                set_options_data(1);
                set_options_restart(1);
                set_thickness(2.4);
                set_periodicbottom(true);
        }
| Mdouble ChuteBottom::get_periodicbottom | ( | ) |  [inline] | 
        
References periodicbottom.
{return periodicbottom;}
| Mdouble ChuteBottom::get_thickness | ( | ) |  [inline] | 
        
| void ChuteBottom::make_rough_bottom | ( | ParticleHandler & | ChuteParticleHandler | ) |  [inline] | 
        
todo{Dinant is not a fan of this alogirm (i.e. poping back stuff while in iterator}
References ParticleHandler::begin(), ParticleHandler::end(), Chute::get_collision_time(), MD::get_dt(), Chute::get_InflowParticleRadius(), ParticleHandler::get_NumberOfParticles(), MD::get_ParticleHandler(), Chute::MaxInflowParticleRadius, ParticleHandler::removeParticle(), Chute::set_ChuteAngle(), Chute::set_collision_time_and_restitution_coefficient(), Chute::set_dt(), Chute::set_FixedParticleRadius(), Chute::set_InflowHeight(), MD::set_mu(), Chute::set_RandomizedBottom(), MD::set_savecount(), ParticleHandler::set_StorageCapacity(), MD::set_tmax(), MD::solve(), and thickness.
Referenced by Chute::create_bottom().
        {
                // set all parameters that should be different from the original chute 
                set_ChuteAngle(0.0);
                set_InflowHeight(25.*get_InflowParticleRadius());
                //~ set_InflowHeight(45.*get_InflowParticleRadius()); note: Changing the Inflow height was an attempt to make the bottom density homogeneous, but it did not have the desired effect
                set_RandomizedBottom(1);
                set_FixedParticleRadius(get_InflowParticleRadius());
                set_collision_time_and_restitution_coefficient(get_collision_time()*10.0, 0.2);
                set_mu(0);
                
                set_dt();
                set_dt(get_dt()*10.0);
                set_tmax(get_dt()*2e3);
                //set_number_of_saves(2);
                set_savecount(100);
                //solve
                solve();
                //create_bottom         
                Mdouble height = 0;
                for (vector<Particle*>::iterator it=get_ParticleHandler().begin(); it!=get_ParticleHandler().end(); it++) {
                        height = max(height,(*it)->get_Position().Z);
                }
                
                cout << "Thickness" << thickness << endl;
                //now cut a slice of width 2*MaxInflowParticleRadius
                for (vector<Particle*>::iterator it=get_ParticleHandler().begin(); it!=get_ParticleHandler().end();) {
                        if ((*it)->get_Position().Z < height - (1.0+thickness)*MaxInflowParticleRadius || (*it)->get_Position().Z > height - MaxInflowParticleRadius) {
                                //delete particles outside the given range
                                //*it = get_ParticleHandler().back();
                                //get_ParticleHandler().removeLastParticle(); 
                                get_ParticleHandler().removeParticle((*it)->get_Index());
                        } else {
                                //fix the remaining particles on the floor
                                (*it)->get_Position().Z -= height - MaxInflowParticleRadius;
                                (*it)->fixParticle();
                                it++;
                        }
                }
                
                //copy the rough bottom over
                ChuteParticleHandler.set_StorageCapacity(get_ParticleHandler().get_NumberOfParticles());
                cout << "Chute bottom finished, consisting of " << get_ParticleHandler().get_NumberOfParticles() << " Particles" << endl; 
                
                ChuteParticleHandler = get_ParticleHandler();
        }
| void ChuteBottom::set_periodicbottom | ( | bool | new_ | ) |  [inline] | 
        
| void ChuteBottom::set_thickness | ( | Mdouble | new_ | ) |  [inline] | 
        
References thickness.
Referenced by constructor().
                                        {
                if (new_>0.0) thickness=new_;
                else {cerr<<"Error: thickness " << new_ << " negative"<<endl; exit(-1);}
        }
| void ChuteBottom::setup_particles_initial_conditions | ( | ) |  [inline, virtual] | 
        
initialize particle position, velocity, radius
This initially set up the particles///.
todo{Why is this an error?}
Reimplemented from Chute.
References Particle::compute_particle_mass(), Chute::create_bottom(), cubic, Chute::FixedParticleRadius, Chute::get_FixedParticleRadius(), Chute::get_InflowParticleRadius(), Chute::get_MaxInflowParticleRadius(), Chute::get_MinInflowParticleRadius(), ParticleHandler::get_NumberOfParticles(), MD::get_ParticleHandler(), Particle::get_Position(), Particle::get_Radius(), RNG::get_RN(), MD::get_xmax(), MD::get_xmin(), MD::get_ymax(), MD::get_ymin(), MD::get_zmax(), MD::get_zmin(), HGRID_base::HGRID_actions_before_time_loop(), Chute::IsInsertable(), Chute::max_failed, Chute::num_created, Chute::P0, periodicbottom, MD::random, HGRID_base::set_HGRID_cell_to_cell_ratio(), HGRID_base::set_HGRID_max_levels(), HGRID_base::set_HGRID_num_buckets_to_power(), Particle::set_Radius(), ParticleHandler::set_StorageCapacity(), Particle::set_Velocity(), MD::Species, MD::Walls, MD::WallsPeriodic, Vec3D::X, Vec3D::Y, and Vec3D::Z.
                                                  {     
                
                get_ParticleHandler().set_StorageCapacity((int)min(3.0*get_xmax()*get_ymax()*get_zmax()/cubic(2.0*get_InflowParticleRadius()),1e6));
                create_bottom();
                
                if (periodicbottom) {
                        Walls.resize(1);
                        Walls.back().set(Vec3D(0.0, 0.0, -1.0), -get_zmin()+get_InflowParticleRadius());
                        WallsPeriodic.resize(2);
                        WallsPeriodic[0].set(Vec3D( 1.0, 0.0, 0.0), get_xmin(), get_xmax());
                        WallsPeriodic[1].set(Vec3D( 0.0, 1.0, 0.0), get_ymin(), get_ymax());
                } else {
                        WallsPeriodic.resize(0);
                        Walls.resize(5);
                        Walls[0].set(Vec3D(0.0, 0.0, -1.0), -get_zmin()+get_InflowParticleRadius());
                        Walls[Walls.size()-4].set(Vec3D(-1.0, 0.0, 0.0), -get_xmin());
                        Walls[Walls.size()-3].set(Vec3D( 1.0, 0.0, 0.0),  get_xmax());
                        Walls[Walls.size()-2].set(Vec3D( 0.0,-1.0, 0.0), -get_ymin());
                        Walls[Walls.size()-1].set(Vec3D( 0.0, 1.0, 0.0),  get_ymax());
                }
                
                //add particles
                HGRID_actions_before_time_loop();
                int failed = 0, max_failed = 500;
                //try max_failed times to find new insertable particle
                while (failed<=max_failed){
                        P0.set_Radius(FixedParticleRadius);
                        P0.compute_particle_mass(Species);
                        P0.get_Position().X = random.get_RN(P0.get_Radius(), get_xmax()-P0.get_Radius());
                        P0.get_Position().Y = random.get_RN(P0.get_Radius(), get_ymax()-P0.get_Radius());
                        P0.get_Position().Z = random.get_RN(2*P0.get_Radius(), get_zmax()-P0.get_Radius());
                        P0.set_Velocity(Vec3D(0.0,0.0,0.0));
                        if (IsInsertable(P0)) 
                        {
                                failed = 0; 
                                /*if (Particles.capacity()==Particles.size()) 
                                {
                                        
                                        cerr << "Error in creating bottom; exceeded capacity: " << Particles.size() << endl; exit(-1);
                                }*/
                                //Particles.push_back (P0); 
                                //Undate the link list so this particle is back in the grid
                                //grid->objectBucket[Particles[Particles.size()-1].bucket] = Particles.size()-1;
                                //grid->objectBucket[Particles[Particles.size()-1].bucket] = &Particles[Particles.size()-1];
                                num_created++;
                        } 
                        else failed++;
                }
                //set_Nmax(get_ParticleHandler().get_NumberOfParticles());
                cout << "N=" << get_ParticleHandler().get_NumberOfParticles() << endl;
                //fix hgrid (there is still an issue when particles are polydispersed)
                //assume 1-2 levels are optimal (which is the case for mono and bidispersed) and set the cell size to min and max 
                // !this is not optimal for polydispersed
                Mdouble minCell = 2.*min(get_FixedParticleRadius(),get_MinInflowParticleRadius());
                Mdouble maxCell = 2.*max(get_FixedParticleRadius(),get_MaxInflowParticleRadius());
                if ((minCell==maxCell)|(minCell==0.)) set_HGRID_max_levels(1);
                else set_HGRID_max_levels(2);
                set_HGRID_cell_to_cell_ratio (1.0000000001*maxCell/minCell);
                //optimize number of buckets
                set_HGRID_num_buckets_to_power(get_ParticleHandler().get_NumberOfParticles()*1.5);
                //end: fix hgrid
                
                //~ info();
        }
bool ChuteBottom::periodicbottom [private] | 
        
Referenced by get_periodicbottom(), set_periodicbottom(), and setup_particles_initial_conditions().
Mdouble ChuteBottom::thickness [private] | 
        
Referenced by get_thickness(), make_rough_bottom(), and set_thickness().
 1.7.6.1