PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
|
A class for discrete element particle simulation with peridynamic model More...
#include <demModel.h>
Public Member Functions | |
DEMModel (inp::Input *deck, std::string modelName="DEMModel") | |
Constructor. | |
void | log (std::ostringstream &oss, int priority=0, bool check_condition=true, int override_priority=-1, bool screen_out=false) |
Prints message if any of these two conditions are true. | |
void | log (const std::string &str, int priority=0, bool check_condition=true, int override_priority=-1, bool screen_out=false) |
Prints message if any of these two conditions are true. | |
virtual void | run (inp::Input *deck) |
Main driver to simulate. | |
Methods to initialize and run model | |
virtual void | restart (inp::Input *deck) |
Restarts the simulation from previous state. | |
virtual void | init () |
Initialize remaining data members. | |
virtual void | close () |
Closure operations. | |
Methods to implement explicit time integration | |
virtual void | integrate () |
Perform time integration. | |
virtual void | integrateStep () |
Performs one time step. | |
virtual void | integrateCD () |
Perform time integration using central-difference scheme. | |
virtual void | integrateVerlet () |
Perform time integration using velocity verlet scheme. | |
Compute methods | |
virtual void | computeForces () |
Computes peridynamic forces and contact forces. | |
virtual void | computePeridynamicForces () |
Computes peridynamic forces. | |
virtual void | computeExternalForces () |
Computes external/boundary condition forces. | |
virtual void | computeExternalDisplacementBC () |
Applies displacement boundary conditions. | |
virtual void | computeContactForces () |
Computes contact forces. | |
virtual void | applyInitialCondition () |
Applies initial condition. | |
Setup methods | |
virtual void | createParticles () |
Creates particles in a given container. | |
virtual void | createParticlesFromFile (size_t z, std::shared_ptr< particle::RefParticle > ref_p) |
Creates particles in a Hexagonal arrangement. | |
virtual void | createParticleUsingParticleZoneGeomObject (size_t z, std::shared_ptr< particle::RefParticle > ref_p) |
Creates particles in a given container. | |
virtual void | createGeometryAtSite (const double &particle_radius, const double &particle_orient, const util::Point &site, const std::vector< double > &rep_geom_params, const std::shared_ptr< util::geometry::GeomObject > &rep_geom_p, std::shared_ptr< util::geometry::GeomObject > &p_geom) |
Creates geometrical object for a particle given particle radius, orientation, and site location. | |
virtual void | updateGeometryObjectsPostInit () |
Update varioud geometry objects associated with container, particles, and reference particles. | |
virtual void | updateContactNeighborlist () |
Update neighborlist for contact. | |
virtual void | updatePeridynamicNeighborlist () |
Update neighborlist for peridynamics force. | |
virtual void | updateNeighborlistCombine () |
Update neighborlist for contact and peridynamics force. | |
virtual void | setupContact () |
Creates particles in a given container. | |
virtual void | setupQuadratureData () |
Sets up quadrature data. | |
virtual bool | updateContactNeighborSearchParameters () |
Update contact neighbor search parameters. | |
Methods to handle output and debug | |
virtual void | output () |
Output the snapshot of data at current time step. | |
std::string | ppTwoParticleTest () |
Function that handles post-processing for two particle collision test and returns maximum vertical displacement of particle. | |
std::string | ppCompressiveTest () |
Function that handles post-processing for compressive test of particulate media by rigid wall and returns wall penetration and reaction force on wall. | |
virtual void | checkStop () |
Checks if simulation should be stopped due to abnormal state of system. | |
Public Member Functions inherited from model::ModelData | |
ModelData (inp::Input *deck) | |
Constructor. | |
const particle::BaseParticle * | getParticleFromAllList (size_t i) const |
Get pointer to base particle. | |
particle::BaseParticle *& | getParticleFromAllList (size_t i) |
Get pointer to base particle. | |
const particle::BaseParticle * | getParticleFromParticleList (size_t i) const |
Get pointer to particle (excluding wall) | |
particle::BaseParticle *& | getParticleFromParticleList (size_t i) |
const particle::BaseParticle * | getParticleFromWallList (size_t i) const |
Get pointer to wall. | |
particle::BaseParticle *& | getParticleFromWallList (size_t i) |
double | getDensity (size_t i) |
Get density of particle. | |
double | getHorizon (size_t i) |
Get horizon of particle. | |
size_t & | getPtId (size_t i) |
Get particle id given the location in particle list. | |
const size_t & | getPtId (size_t i) const |
Get particle id given the location in particle list. | |
void | setPtId (size_t i, const size_t &id) |
Set particle id given the location in particle list. | |
double | getKeyData (std::string key, bool issue_err=false) |
Get data for a key. | |
void | appendKeyData (std::string key, double data, bool issue_err=false) |
Append value to data associated with key. | |
void | setKeyData (std::string key, double data, bool issue_err=false) |
Set value to data associated with key. | |
util::Point & | getXRef (size_t i) |
Get reference coordinate of the node. | |
const util::Point & | getXRef (size_t i) const |
Get reference coordinate of the node. | |
void | setXRef (size_t i, const util::Point &x) |
Set reference coordinate of the node. | |
void | addXRef (size_t i, const util::Point &x) |
Add reference coordinate of the node. | |
void | setXRef (size_t i, int dof, double x) |
Set specific reference coordinate of the node. | |
void | addXRef (size_t i, int dof, double x) |
Add specific reference coordinate of the node. | |
util::Point & | getX (size_t i) |
Get current coordinate of the node. | |
const util::Point & | getX (size_t i) const |
Get current coordinate of the node. | |
void | setX (size_t i, const util::Point &x) |
Set current coordinate of the node. | |
void | addX (size_t i, const util::Point &x) |
Add current coordinate of the node. | |
void | setX (size_t i, int dof, double x) |
Set specific current coordinate of the node. | |
void | addX (size_t i, int dof, double x) |
Add to specific current coordinate of the node. | |
util::Point & | getU (size_t i) |
Get displacement of the node. | |
const util::Point & | getU (size_t i) const |
Get displacement of the node. | |
void | setU (size_t i, const util::Point &u) |
Set displacement of the node. | |
void | addU (size_t i, const util::Point &u) |
Add to displacement of the node. | |
void | setU (size_t i, int dof, double u) |
Set displacement of the node. | |
void | addU (size_t i, int dof, double u) |
Add to displacement of the node. | |
util::Point & | getV (size_t i) |
Get velocity of the node. | |
const util::Point & | getV (size_t i) const |
Get velocity of the node. | |
void | setV (size_t i, const util::Point &v) |
Set velocity of the node. | |
void | addV (size_t i, const util::Point &v) |
Add to velocity of the node. | |
void | setV (size_t i, int dof, double v) |
Set velocity of the node. | |
void | addV (size_t i, int dof, double v) |
Add to velocity of the node. | |
util::Point & | getF (size_t i) |
Get force of the node. | |
const util::Point & | getF (size_t i) const |
Get force of the node. | |
void | setF (size_t i, const util::Point &f) |
Set force of the node. | |
void | addF (size_t i, const util::Point &f) |
Add to force of the node. | |
void | setF (size_t i, int dof, double f) |
Set force of the node. | |
void | addF (size_t i, int dof, double f) |
Add to force of the node. | |
double & | getVol (size_t i) |
Get volume of the node. | |
const double & | getVol (size_t i) const |
Get volume of the node. | |
void | setVol (size_t i, const double &vol) |
Set volume of the node. | |
void | addVol (size_t i, const double &vol) |
Add to volume of the node. | |
uint8_t & | getFix (size_t i) |
Get fixity of the node. | |
const uint8_t & | getFix (size_t i) const |
Get fixity of the node. | |
void | setFix (size_t i, const unsigned int &dof, const bool &flag) |
Set fixity of the node. | |
double & | getMx (size_t i) |
Get weighted-volume (mx) of the node. | |
const double & | getMx (size_t i) const |
Get weighted-volume (mx) of the node. | |
void | setMx (size_t i, const double &mx) |
Set weighted-volume (mx) of the node. | |
void | addMx (size_t i, const double &mx) |
Add to weighted-volume (mx) of the node. | |
double & | getThetax (size_t i) |
Get volumetric deformation (thetax) of the node. | |
const double & | getThetax (size_t i) const |
Get volumetric deformation (thetax) of the node. | |
void | setThetax (size_t i, const double &thetax) |
Set volumetric deformation (thetax) of the node. | |
void | addThetax (size_t i, const double &thetax) |
Add to volumetric deformation (thetax) of the node. | |
Data Fields | |
std::string | d_name |
Name of the model for logging purposes (useful if other classes are built on top of this class) | |
Data Fields inherited from model::ModelData | |
size_t | d_n |
Current time step. | |
double | d_time |
Current time. | |
double | d_currentDt |
Current timestep. | |
size_t | d_infoN |
Print log step interval. | |
std::map< std::string, double > | d_dbgData |
Debug data. | |
std::ofstream | d_ppFile |
File stream to output information. | |
inp::Input * | d_input_p |
Pointer to Input object. | |
std::shared_ptr< inp::ModelDeck > | d_modelDeck_p |
Model deck. | |
std::shared_ptr< inp::RestartDeck > | d_restartDeck_p |
Restart deck. | |
std::shared_ptr< inp::OutputDeck > | d_outputDeck_p |
Output deck. | |
std::shared_ptr< inp::ParticleDeck > | d_pDeck_p |
Particle deck. | |
std::shared_ptr< inp::ContactDeck > | d_cDeck_p |
Contact deck. | |
bool | d_stop |
flag to stop the simulation midway | |
double | d_hMax |
Minimum mesh over all particles and walls. | |
double | d_hMin |
Maximum mesh over all particles and walls. | |
double | d_maxContactR |
Maximum contact radius between over pairs of particles and walls. | |
size_t | d_contNeighUpdateInterval |
Neighborlist update interval. | |
size_t | d_contNeighTimestepCounter |
Contact neighborlist time step counter. | |
double | d_contNeighSearchRadius |
Neighborlist contact search radius (multiple of d_maxContactR). This variable will be updated during simulation based on maximum velocity. | |
std::vector< std::shared_ptr< particle::RefParticle > > | d_referenceParticles |
Pointer to reference particle. | |
std::vector< particle::BaseParticle * > | d_particlesListTypeAll |
List of particles + walls. | |
std::vector< particle::BaseParticle * > | d_particlesListTypeParticle |
List of particles. | |
std::vector< particle::BaseParticle * > | d_particlesListTypeWall |
List of walls. | |
std::vector< inp::MatData > | d_particlesMatDataList |
List of particle material data. Only populated if needed for calculation of stress or other quantities. | |
std::vector< double > | d_maxVelocityParticlesListTypeAll |
Maximum velocity among all nodes in the particle for each particle. | |
double | d_maxVelocity |
Maximum velocity among all nodes. | |
std::vector< std::vector< size_t > > | d_zInfo |
Zone information of particles. For zone 0, d_zInfo[0] = [n1, n2] where n1 is the index at which the particle in this zone starts in d_particlesListTypeAll and n2 is the index + 1, where index is at which the particle in this zone ends. | |
std::unique_ptr< loading::ParticleULoading > | d_uLoading_p |
Pointer to displacement Loading object. | |
std::unique_ptr< loading::ParticleFLoading > | d_fLoading_p |
Pointer to force Loading object. | |
std::unique_ptr< geometry::Fracture > | d_fracture_p |
Fracture state of bonds. | |
std::unique_ptr< NSearch > | d_nsearch_p |
Pointer to nsearch. | |
std::vector< util::Point > | d_xRef |
reference positions of the nodes | |
std::vector< util::Point > | d_x |
Current positions of the nodes. | |
std::vector< util::Point > | d_u |
Displacement of the nodes. | |
std::vector< util::Point > | d_v |
Velocity of the nodes. | |
std::vector< double > | d_vMag |
Magnitude of velocity of the nodes. | |
std::vector< util::Point > | d_f |
Total force on the nodes. | |
std::vector< double > | d_vol |
Nodal volumes. | |
std::vector< size_t > | d_ptId |
Global node to particle id (walls are assigned id after last particle id) | |
std::vector< std::vector< size_t > > | d_neighC |
Neighbor data for contact forces. | |
std::vector< std::vector< size_t > > | d_neighPd |
Neighbor data for peridynamic forces. | |
std::vector< std::vector< float > > | d_neighPdSqdDist |
Square distance neighbor data for peridynamic forces. | |
std::vector< std::vector< std::vector< size_t > > > | d_neighWallNodes |
Neighbor data for contact between particle and walls. | |
std::vector< std::vector< std::vector< double > > > | d_neighWallNodesDistance |
Neighbor data (distance) for contact between particle and walls. | |
std::vector< std::vector< size_t > > | d_neighWallNodesCondensed |
Neighbor data for contact between particle and walls condensed into single vector for each particle. | |
std::vector< uint8_t > | d_fix |
Vector of fixity mask of each node. | |
std::vector< uint8_t > | d_forceFixity |
Vector of fixity mask of each node for force. | |
std::vector< double > | d_thetaX |
Dilation. | |
std::vector< double > | d_mX |
Weighted volume. | |
std::vector< size_t > | d_fPdCompNodes |
List of global nodes on which force (peridynamic/internal) is to be computed. | |
std::vector< size_t > | d_fContCompNodes |
List of global nodes on which force (contact) is to be computed. | |
std::vector< float > | d_Z |
Damage at nodes. | |
std::vector< float > | d_e |
Energy of the nodes. | |
std::vector< float > | d_w |
Work done on each of the nodes. | |
std::vector< float > | d_phi |
Damage function \( \phi \) at the nodes. | |
std::vector< float > | d_eF |
Fracture energy of the nodes. | |
std::vector< float > | d_eFB |
Bond-based fracture energy of the nodes. | |
std::vector< util::Point > | d_xQuadCur |
Current position of quadrature points. | |
std::vector< util::SymMatrix3 > | d_strain |
Strain in elements (values at quadrature points) | |
std::vector< util::SymMatrix3 > | d_stress |
Stress in elements (values at quadrature points) | |
float | d_te |
Total internal energy. | |
float | d_tw |
Total work done. | |
float | d_tk |
Total kinetic energy. | |
float | d_teF |
Total fracture energy. | |
float | d_teFB |
Total bond-based fracture energy. | |
A class for discrete element particle simulation with peridynamic model
We consider central difference for time integration.
This class acts as a holder of lower rank classes, such as set of particles, neighborlist, etc., and uses the methods and data of the lower rank classes to perform calculation.
Definition at line 32 of file demModel.h.
|
explicit |
Constructor.
deck | The input deck |
Definition at line 44 of file demModel.cpp.
References model::ModelData::d_outputDeck_p, and util::io::initLogger().
|
virtual |
Applies initial condition.
Definition at line 1068 of file demModel.cpp.
References util::parallel::getNThreads().
Referenced by twoparticle_demo::Model::integrate().
|
virtual |
Checks if simulation should be stopped due to abnormal state of system.
Definition at line 2110 of file demModel.cpp.
References util::isGreater(), and util::methods::maxLengthAndMaxLengthIndex().
Referenced by twoparticle_demo::Model::integrate().
|
virtual |
Closure operations.
Definition at line 104 of file demModel.cpp.
Referenced by twoparticle_demo::Model::run().
|
virtual |
Computes contact forces.
Definition at line 820 of file demModel.cpp.
References util::parallel::getNThreads().
|
virtual |
Applies displacement boundary conditions.
Definition at line 814 of file demModel.cpp.
Referenced by twoparticle_demo::Model::integrate().
|
virtual |
Computes external/boundary condition forces.
Definition at line 791 of file demModel.cpp.
References util::parallel::getNThreads().
Referenced by peridynamics::Model::computeForces(), and twoparticle_demo::Model::integrate().
|
virtual |
Computes peridynamic forces and contact forces.
Reimplemented in peridynamics::Model.
Definition at line 462 of file demModel.cpp.
References util::parallel::getNThreads(), and util::methods::timeDiff().
|
virtual |
Computes peridynamic forces.
Definition at line 602 of file demModel.cpp.
References util::parallel::getNThreads().
Referenced by peridynamics::Model::computeForces().
|
virtual |
Creates geometrical object for a particle given particle radius, orientation, and site location.
Definition at line 1377 of file demModel.cpp.
References util::geometry::acceptable_geometries, util::geometry::createGeomObject(), util::methods::isTagInList(), and util::io::printStr().
|
virtual |
Creates particles in a given container.
Definition at line 1097 of file demModel.cpp.
References fe::createUniformMesh(), and fe::Mesh::d_dim.
|
virtual |
Creates particles in a Hexagonal arrangement.
How the generation works:
z | Zone id |
ref_p | Shared pointer to reference particle from which we need to create new particles |
Definition at line 1266 of file demModel.cpp.
References util::io::printStr(), rw::reader::readParticleCsvFile(), rw::reader::readParticleWithOrientCsvFile(), and util::transform_to_uniform_dist().
|
virtual |
Creates particles in a given container.
Definition at line 1220 of file demModel.cpp.
|
virtual |
Initialize remaining data members.
Definition at line 109 of file demModel.cpp.
References material::computeStateMx(), util::methods::isFree(), util::methods::max(), and util::methods::timeDiff().
Referenced by twoparticle_demo::Model::run().
|
virtual |
Perform time integration.
Reimplemented in twoparticle_demo::Model.
Definition at line 268 of file demModel.cpp.
References util::methods::timeDiff().
|
virtual |
Perform time integration using central-difference scheme.
Central difference scheme
\[ u_{new} = \Delta t^2 (f_{int} + f_{ext}) / \rho + \Delta t v_{old} + u_{old} \]
\[ v_{new} = \frac{u_{new} - u_{old}}{\Delta t}. \]
Definition at line 349 of file demModel.cpp.
References util::parallel::getNThreads().
|
virtual |
Performs one time step.
Depending on the time-stepping scheme specified in the input file, this will either call integrateCD or integrateVerlet.
Definition at line 342 of file demModel.cpp.
Referenced by twoparticle_demo::Model::integrate().
|
virtual |
Perform time integration using velocity verlet scheme.
Definition at line 392 of file demModel.cpp.
References util::parallel::getNThreads().
void model::DEMModel::log | ( | const std::string & | str, |
int | priority = 0 , |
||
bool | check_condition = true , |
||
int | override_priority = -1 , |
||
bool | screen_out = false |
||
) |
Prints message if any of these two conditions are true.
str | Message string |
priority | Priority of message |
check_condition | Specify whether condition for logging/printing message is to be checked |
override_priority | Specify new priority |
screen_out | Specify whether to print the message also to screen (using std::cout) |
Definition at line 61 of file demModel.cpp.
References util::io::log().
void model::DEMModel::log | ( | std::ostringstream & | oss, |
int | priority = 0 , |
||
bool | check_condition = true , |
||
int | override_priority = -1 , |
||
bool | screen_out = false |
||
) |
Prints message if any of these two conditions are true.
oss | Stream |
priority | Priority of message |
check_condition | Specify whether condition for logging/printing message is to be checked |
override_priority | Specify new priority |
screen_out | Specify whether to print the message also to screen (using std::cout) |
Definition at line 53 of file demModel.cpp.
References util::io::log().
Referenced by peridynamics::Model::computeForces(), twoparticle_demo::Model::integrate(), twoparticle_demo::Model::run(), and twoparticle_demo::Model::twoParticleTestPenetrationDist().
|
virtual |
Output the snapshot of data at current time step.
Definition at line 1921 of file demModel.cpp.
References fe::getCurrentQuadPoints(), fe::getStrainStress(), util::io::getTabS(), util::methods::isTagInList(), and util::io::printStr().
Referenced by twoparticle_demo::Model::integrate().
std::string model::DEMModel::ppCompressiveTest | ( | ) |
Function that handles post-processing for compressive test of particulate media by rigid wall and returns wall penetration and reaction force on wall.
Definition at line 2161 of file demModel.cpp.
std::string model::DEMModel::ppTwoParticleTest | ( | ) |
Function that handles post-processing for two particle collision test and returns maximum vertical displacement of particle.
Definition at line 2055 of file demModel.cpp.
References util::isGreater(), and util::isLess().
|
virtual |
Restarts the simulation from previous state.
deck | Input deck |
Definition at line 84 of file demModel.cpp.
|
virtual |
Main driver to simulate.
deck | Input deck |
Reimplemented in twoparticle_demo::Model.
Definition at line 68 of file demModel.cpp.
Referenced by main(), and test::testPeriDEM().
|
virtual |
Creates particles in a given container.
Definition at line 1490 of file demModel.cpp.
References inp::ContactPairDeck::d_betan, inp::ContactPairDeck::d_betanFactor, inp::ContactPairDeck::d_computeContactR, inp::ContactPairDeck::d_contactR, inp::ContactPairDeck::d_eps, inp::ContactPairDeck::d_kappa, inp::ContactPairDeck::d_Kn, inp::ContactPairDeck::d_KnFactor, inp::ContactPairDeck::d_mu, inp::ContactPairDeck::d_vMax, util::equivalentMass(), and util::isGreater().
|
virtual |
Sets up quadrature data.
Definition at line 1561 of file demModel.cpp.
References fe::BaseElem::getNumQuadPoints(), util::methods::isTagInList(), util::vtk_type_line, util::vtk_type_quad, util::vtk_type_tetra, and util::vtk_type_triangle.
|
virtual |
Update neighborlist for contact.
Definition at line 1655 of file demModel.cpp.
References util::parallel::getNThreads().
|
virtual |
Update contact neighbor search parameters.
Definition at line 1767 of file demModel.cpp.
References util::isGreater(), util::isLess(), util::methods::max(), and util::methods::maxIndex().
|
virtual |
Update varioud geometry objects associated with container, particles, and reference particles.
Definition at line 1459 of file demModel.cpp.
References util::geometry::createGeomObject(), and util::methods::isTagInList().
|
virtual |
Update neighborlist for contact and peridynamics force.
Definition at line 1916 of file demModel.cpp.
|
virtual |
Update neighborlist for peridynamics force.
Definition at line 1618 of file demModel.cpp.
References util::parallel::getNThreads().
std::string model::DEMModel::d_name |
Name of the model for logging purposes (useful if other classes are built on top of this class)
Definition at line 42 of file demModel.h.
Referenced by twoparticle_demo::Model::integrate(), and twoparticle_demo::Model::run().