88 for (
size_t s = 0; s < d_bcData.size(); s++) {
91 const auto &bc = d_bcData[s];
94 if (!needToProcessParticle(
particle->getId(), bc))
98 auto reg_box = bc.d_regionGeomData.d_geom_p->box();
102 tf::Taskflow taskflow;
104 taskflow.for_each_index(
105 (std::size_t) 0,
particle->getNumNodes(), (std::size_t) 1,
106 [time, &
particle, bc, reg_box,
this](std::size_t i) {
108 const auto x = particle->getXRefLocal(i);
112 if (!bc.d_isRegionActive) {
114 box = particle->d_geom_p->box();
117 if (needToComputeDof(x,
particle->getId(), bc)) {
120 if (bc.d_spatialFnType ==
"hat_x") {
121 fmax = bc.d_spatialFnParams[0] *
122 util::hatFunction(x.d_x, box.first.d_x,
124 }
else if (bc.d_spatialFnType ==
"hat_y") {
125 fmax = bc.d_spatialFnParams[0] *
126 util::hatFunction(x.d_y, box.first.d_y,
128 }
else if (bc.d_spatialFnType ==
"sin_x") {
129 double a = M_PI * bc.d_spatialFnParams[0];
130 fmax = bc.d_spatialFnParams[0] * std::sin(a * x.d_x);
131 }
else if (bc.d_spatialFnType ==
"sin_y") {
132 double a = M_PI * bc.d_spatialFnParams[0];
133 fmax = bc.d_spatialFnParams[0] * std::sin(a * x.d_y);
134 }
else if (bc.d_spatialFnType ==
"linear_x") {
135 double a = bc.d_spatialFnParams[0];
136 fmax = bc.d_spatialFnParams[0] * a * x.d_x;
137 }
else if (bc.d_spatialFnType ==
"linear_y") {
138 double a = bc.d_spatialFnParams[0];
139 fmax = bc.d_spatialFnParams[0] * a * x.d_y;
143 if (bc.d_timeFnType ==
"linear")
145 else if (bc.d_timeFnType ==
"linear_step")
147 bc.d_timeFnParams[2]);
148 else if (bc.d_timeFnType ==
"linear_slow_fast") {
150 fmax *= bc.d_timeFnParams[3] * time;
152 fmax *= bc.d_timeFnParams[2] * time;
153 }
else if (bc.d_timeFnType ==
"sin") {
154 double a = M_PI * bc.d_timeFnParams[1];
155 fmax *= std::sin(a * time);
159 fmax *= bc.d_timeFnParams[0];
162 for (
auto d : bc.d_direction) {
172 executor.run(taskflow).get();
bool needToComputeDof(const util::Point &x, size_t id, const inp::PBCData &bc)
Function that checks if we need to do computation at a given point x within a particle with id = id.
void apply(const double &time, particle::BaseParticle *particle)
Applies force boundary condition.
ParticleFLoading(std::vector< inp::PBCData > &bc_data)
Constructor.
bool needToProcessParticle(size_t id, const inp::PBCData &bc)
Function that checks if given particle with id = id needs to be processed within boundary condition d...
std::vector< inp::PBCData > d_bcData
List of displacement bcs.
A class to store particle geometry, nodal discretization, and methods.
bool isInList(const size_t &i, const std::vector< size_t > &list)
Collection of methods and data related to particle object.