Class to calculate the harmonic force on a particle.
More...
#include <HarmonicForce.h>
Class to calculate the harmonic force on a particle.
Definition at line 12 of file HarmonicForce.h.
◆ HarmonicForce()
Constructor for the GlobalDownwardsGravity class.
Definition at line 6 of file HarmonicForce.cpp.
7 if (std::holds_alternative<SimulationParams::DirectSumType>(container_data)) {
11 domain_size = std::get<SimulationParams::LinkedCellsType>(container_data).domain_size;
std::array< double, 3 > domain_size
◆ calculateForce()
std::array< double, 3UL > HarmonicForce::calculateForce |
( |
Particle & |
p | ) |
const |
|
overridevirtual |
Calculates the harmonic force on a particle supplied by all its connected neighbors.
- Parameters
-
- Returns
- std::array<double, 3UL> Force vector
Implements SimpleForceSource.
Definition at line 15 of file HarmonicForce.cpp.
16 auto total_harmonic_force = std::array<double, 3UL>{0, 0, 0};
19 Particle* connected_particle = &p + ptr_diff;
20 auto displacement = connected_particle->
getX() - p.
getX();
23 for (
size_t i = 0; i < displacement.size(); i++) {
24 if (std::abs(displacement[i]) >
domain_size[i] * 0.5) {
25 bool is_positive = displacement[i] > 0;
37 const auto f_harmonic = (k * (dist - l_0) / dist) * displacement;
39 total_harmonic_force = total_harmonic_force + f_harmonic;
42 return total_harmonic_force;
Class to represent a particle.
const std::array< double, 3 > & getX() const
Gets the position of the particle.
const std::vector< std::tuple< long, double, double > > & getConnectedParticles() const
Gets the list of connected particles.
auto L2Norm(const Container &c)
◆ operator std::string()
HarmonicForce::operator std::string |
( |
| ) |
const |
|
explicitoverridevirtual |
◆ domain_size
std::array<double, 3> HarmonicForce::domain_size |
|
private |
◆ is_finite_container
bool HarmonicForce::is_finite_container |
|
private |
The documentation for this class was generated from the following files: