MercuryDPM
Alpha
|
File ChuteDemo.cpp treats particles cascading down an inclined chute. The entire code of this problem can be viewed here: Particles on an inclined chute (code).
The following headers are included:
The particle species is manually set here, and therefore needs to be included. We're treating a chute problem here, and the Chute class needs to be included therefore as well. The particles, walls and boundaries classes are already implemented by the chute class and don't need inclusion here.
int main()
Since the whole structure of the problem is already implemented in the Chute class, no separate class needs to be set up. The setup of initial conditions of the Chute class is shortly treated at the end of this section.
The main driver program starts by initialising a Chute object. Next, the most basic problem properties are set, namely its name (which determines the naming of the data output files), save count (which is the number of time steps skipped between every saved one), particle collision time (which is a species property, but also used in setting the time step), time step and maximum time. Note, that the total number of time steps saved to the output files is not directly set, but is equal to the maximum time divided by time step size and save count.
Next, the particle properties are set. setFixedParticleRadius()
sets the radius of the fixed chute bottom particles, while setInflowParticleRadius()
sets the inflow particles to be monidisperse with the given particle radius. If inflow particles with random radii are desired, setMinInflowParticleRadius()
and setMaxInflowParticleRadius()
can be used instead to set the minimum and maximum particle radius, respectively.
The particle species (i.e. its intrinsic material properties) are set next, by specifying the density (species.setDensity()
) and the characteristic collision time and coefficient of restitution (with a typical particle mass given; species.setCollisionTimeAndRestitutionCoefficient( )
).
The chute properties are subsequently set by specifying the chute's length, width and angle relative to the horizontal.
The chute inflow parameters (besides the previously set inflow particle properties) are set by specifying the inflow height (in Z-direction), the mean iflow particle velocity (in X-direction), and the particle velocity variance (in ratio of the mean velocity).
After all the problem parameters are specified, the simulation is run by calling the solve() method.
The setup of initial conditions of the Chute class starts by checking for the presence of a species, and returns an error if there is none. Make sure therefore that you assign a species to the Chute object's speciesHandler before you call the solve() method.
After that, the side walls (in the Y-direction) are set up by calling Chute::setSideWalls(). These are set to be solid, infinite walls by default, but can be set to be periodic instead by setting Chute::isChutePeriodic_ to be true.
A particle is then created (on the heap) which is assigned the first (and only) species in the speciesHandler which we earlier specified in the driver (ChuteDemo.cpp).
A ChuteInsertionBoundary is created, and its parameters subsequently set by its set() method. The set() method arguments are, respectively:
p:
the previously specified particlemaxFailed_:
internally used parameter Vec3D(getXMin(), getYMin(), getZMin())
: the first defining corner of the cuboidal insertion boundary Vec3D(getXMax(), getYMax(), getZMax())
: the second defining corner of the cuboidal insertion boundarymin-
/ maxInflowParticleRadius_:
the minimum and maximum radii of inflow particlesfixedParticleRadius_:
the particle radius making up the chute bottominflowVelocity(Variance)_:
the mean velocity of inflow particles and the allowed variance about the meanAfter setting the insertion boundary characteristics, it is added to the problem's boundaryHandler.
Lastly, the chute's bottom is created. The type of bottom created may be set by calling the Chute::setRoughBottomType() method in the driver, giving either of the following four arguments (which are of type enum
RoughBottomType
):
(Return to Overview of advanced tutorials)