Peano 4
Loading...
Searching...
No Matches
Springs.cpp
Go to the documentation of this file.
1#include "Springs.h"
2
3
7 double h
8) {
10 double distance = tarch::la::norm2( deltaX );
11
12 double force = 0.0;
13 force =
14 std::max(
15 -1.0,
16 std::pow(h/distance,6.0) - std::pow(h/distance,12.0)
17 );
18 return force * 1.0/distance * deltaX;
19}
Scalar norm2(const Vector< Size, Scalar > &vector)
Computes the 2-norm of the vector, i.e.
tarch::la::Vector< Dimensions, double > springPotential(const tarch::la::Vector< Dimensions, double > &p1, const tarch::la::Vector< Dimensions, double > &p2, double h)
Assumes that there is no force in-between two particles p1 and p2 if they are h away from each other.
Definition Springs.cpp:4
Simple vector class.
Definition Vector.h:134