OGS
ComputeResiduum.cpp
Go to the documentation of this file.
1
10#include "ComputeResiduum.h"
11
13
14namespace ProcessLib
15{
16GlobalVector computeResiduum(double const dt, GlobalVector const& x,
17 GlobalVector const& x_prev, GlobalMatrix const& M,
18 GlobalMatrix const& K, GlobalVector const& b)
19{
20 using namespace MathLib::LinAlg;
21 GlobalVector residuum;
22 GlobalVector x_dot;
23 copy(x, x_dot); // tmp = x
24 axpy(x_dot, -1., x_prev); // tmp = x - x_prev
25 scale(x_dot, 1. / dt); // tmp = (x - x_prev)/dt
26 matMult(M, x_dot, residuum); // r = M*x_dot
27 matMultAdd(K, x, residuum, residuum); // r = M*x_dot + K*x
28 axpy(residuum, -1., b); // r = M*x_dot + K*x - b
29 scale(residuum, -1.); // r = -r
30 return residuum;
31}
32} // namespace ProcessLib
Global vector based on Eigen vector.
Definition EigenVector.h:25
GlobalVector computeResiduum(double const dt, GlobalVector const &x, GlobalVector const &x_prev, GlobalMatrix const &M, GlobalMatrix const &K, GlobalVector const &b)