PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
loading Namespace Reference

Collection of methods and database related to loading. More...

Data Structures

class  ParticleFLoading
 A class to apply force boundary condition. More...
 
class  ParticleLoading
 A base class to apply displacement and force boundary condition. More...
 
class  ParticleULoading
 A class to apply displacement boundary condition. More...
 

Functions

void applyIC (particle::BaseParticle *particle, const std::vector< inp::BCBaseDeck > &icVec)
 Applies displacement initial condition.
 
bool needToProcessParticle (size_t id, const inp::BCBaseDeck &bc)
 Function that checks if given particle with id = id needs to be processed within boundary condition data bc.
 
bool needToComputeDof (const util::Point &x, size_t id, const inp::BCBaseDeck &bc)
 Function that checks if we need to do computation at a given point x within a particle with id = id.
 

Detailed Description

Collection of methods and database related to loading.

This namespace provides methods and data members specific to application of displacement and force boundary condition and also initial condition.

Function Documentation

◆ applyIC()

void loading::applyIC ( particle::BaseParticle *  particle,
const std::vector< inp::BCBaseDeck > &  icVec 
)

Applies displacement initial condition.

Parameters
timeCurrent time
particleParticle object pointer
icVecInitial condition data

Definition at line 17 of file particleIC.cpp.

17 {
18 for (size_t s=0; s<icVec.size(); s++) {
19
20 // get alias for bc data
21 const auto &bc = icVec[s];
22
23 if (bc.d_icType != "Constant_Velocity")
24 continue;
25
26 // check if we need to process this particle
27 if (!needToProcessParticle(particle->getId(), bc))
28 continue;
29
30 // get bounding box (quite possibly be generic)
31 auto reg_box = bc.d_regionGeomData.d_geom_p == nullptr ? std::pair<util::Point, util::Point>(util::Point(), util::Point()) : bc.d_regionGeomData.d_geom_p->box();
32
33 tf::Executor executor(util::parallel::getNThreads());
34 tf::Taskflow taskflow;
35
36 taskflow.for_each_index(
37 (std::size_t) 0, particle->getNumNodes(), (std::size_t) 1,
38 [&particle, bc, reg_box] (std::size_t i) {
39
40 // The initial condition is applied by particle list only.
41 // apply velocity condition
42 particle->setVLocal(i, bc.d_icVec);
43 }
44 ); // for_each
45
46 executor.run(taskflow).get();
47 }
48}
bool needToProcessParticle(size_t id, const inp::BCBaseDeck &bc)
Function that checks if given particle with id = id needs to be processed within boundary condition d...
Collection of methods and data related to particle object.
Definition modelData.h:36
unsigned int getNThreads()
Get number of threads to be used by taskflow.
A structure to represent 3d vectors.
Definition point.h:30

References util::parallel::getNThreads(), and needToProcessParticle().

Referenced by PeriDEMModel::applyInitialCondition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ needToComputeDof()

bool loading::needToComputeDof ( const util::Point &  x,
size_t  id,
const inp::BCBaseDeck &  bc 
)

Function that checks if we need to do computation at a given point x within a particle with id = id.

Parameters
xCoordinates of a point within particle (reference coordinate)
idId of particle in all particle list
bcBoundary condition data
Returns
bool True if we compute at x

Definition at line 33 of file particleLoadingUtil.cpp.

35 {
36
37 if (!bc.d_isRegionActive) {
38 if (bc.d_selectionType == "particle" &&
40 return true;
41 }
42 else {
43 if (bc.d_selectionType == "region" && bc.d_regionGeomData.d_geom_p->isInside(x))
44 return true;
45 else if (bc.d_selectionType == "region_with_include_list" &&
46 bc.d_regionGeomData.d_geom_p->isInside(x) &&
48 return true;
49 else if (bc.d_selectionType == "region_with_exclude_list" &&
50 bc.d_regionGeomData.d_geom_p->isInside(x) &&
52 return true;
53 else if (bc.d_selectionType == "region_with_include_list_with_exclude_list" &&
54 bc.d_regionGeomData.d_geom_p->isInside(x) &&
57 return true;
58 }
59
60 return false;
61}
bool isInList(const T &i, const std::vector< T > &list)
Find if data is in the list.
Definition vecMethods.h:270
std::shared_ptr< geom::GeomObject > d_geom_p
Zone geometry.
std::vector< size_t > d_pList
List of particles (if any)
Definition bcBaseDeck.h:52
std::vector< size_t > d_pNotList
List of particles to not include (if any)
Definition bcBaseDeck.h:55
geom::GeomData d_regionGeomData
Region geometry (if any)
Definition bcBaseDeck.h:49
bool d_isRegionActive
Flag that indicates if region-based application of boundary condition is active. So cases of 'region'...
Definition bcBaseDeck.h:46
std::string d_selectionType
Method for applying force e.g.
Definition bcBaseDeck.h:39

References geom::GeomData::d_geom_p, inp::BCBaseDeck::d_isRegionActive, inp::BCBaseDeck::d_pList, inp::BCBaseDeck::d_pNotList, inp::BCBaseDeck::d_regionGeomData, inp::BCBaseDeck::d_selectionType, and util::methods::isInList().

Referenced by loading::ParticleFLoading::apply(), loading::ParticleULoading::apply(), and loading::ParticleULoading::setFixity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ needToProcessParticle()

bool loading::needToProcessParticle ( size_t  id,
const inp::BCBaseDeck &  bc 
)

Function that checks if given particle with id = id needs to be processed within boundary condition data bc.

Parameters
idId of particle in all particle list
bcBoundary condition data
Returns
bool True if particle should be processed further

Definition at line 14 of file particleLoadingUtil.cpp.

14 {
15
16 // if there is a list, and if particle is not in the list, skip
17 bool skip_condition1 = (bc.d_selectionType == "particle"
18 || bc.d_selectionType == "region_with_include_list")
20 // if there is an exclusion list, and if particle is in the list, skip
21 bool skip_condition2 = (bc.d_selectionType == "region_with_exclude_list")
23 // if there is a inclusion and an exclusion list,
24 // and if particle is either in the exclusion list or not in the inclusion list, skip
25 bool skip_condition3 = (bc.d_selectionType == "region_with_include_list_with_exclude_list")
28
29 bool skip = skip_condition1 or skip_condition2 or skip_condition3;
30 return !skip;
31}

References inp::BCBaseDeck::d_pList, inp::BCBaseDeck::d_pNotList, inp::BCBaseDeck::d_selectionType, and util::methods::isInList().

Referenced by loading::ParticleFLoading::apply(), loading::ParticleULoading::apply(), applyIC(), and loading::ParticleULoading::setFixity().

Here is the call graph for this function:
Here is the caller graph for this function: