diff --git a/dune/tectonic/localfriction.hh b/dune/tectonic/localfriction.hh index 5c67dc38e1b496ce2f0306c3f8fb1e73521b0cbd..a202e7f224b46bb27a76e630eb18488779684bf9 100644 --- a/dune/tectonic/localfriction.hh +++ b/dune/tectonic/localfriction.hh @@ -12,23 +12,6 @@ #include "frictionpotential.hh" -// In order to compute (x * y) / |x|, compute x/|x| first -template <class Vector> -double dotFirstNormalised(Vector const &x, Vector const &y) { - double const xnorm = x.two_norm(); - if (xnorm <= 0.0) - return 0.0; - - size_t const xsize = x.size(); - assert(xsize == y.size()); - - double sum = 0; - for (size_t i = 0; i < xsize; ++i) - sum += x[i] / xnorm * y[i]; - - return sum; -} - template <size_t dimension> class LocalFriction { public: using VectorType = Dune::FieldVector<double, dimension>; @@ -63,7 +46,7 @@ template <size_t dimension> class LocalFriction { if (xnorm <= 0.0) D[0] = D[1] = func->differential(0.0) * v.two_norm(); else - D[0] = D[1] = func->differential(xnorm) * dotFirstNormalised(x, v); + D[0] = D[1] = func->differential(xnorm) * (x * v) / xnorm; } /** Formula for the derivative: