OGS
ComputeResiduum.cpp
Go to the documentation of this file.
1
10
#include "
ComputeResiduum.h
"
11
12
#include "
MathLib/LinAlg/LinAlg.h
"
13
14
namespace
ProcessLib
15
{
16
GlobalVector
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
ComputeResiduum.h
LinAlg.h
MathLib::EigenMatrix
Definition
EigenMatrix.h:29
MathLib::EigenVector
Global vector based on Eigen vector.
Definition
EigenVector.h:25
MathLib::LinAlg
Definition
LinAlg.cpp:24
ProcessLib
Definition
ProjectData.h:51
ProcessLib::computeResiduum
GlobalVector computeResiduum(double const dt, GlobalVector const &x, GlobalVector const &x_prev, GlobalMatrix const &M, GlobalMatrix const &K, GlobalVector const &b)
Definition
ComputeResiduum.cpp:16
ProcessLib
Utils
ComputeResiduum.cpp
Generated by
1.10.0