Clear coefficient matrix and residual between assemblies.

Request that the user specify a suitable operator for clearing the
coefficient matrix, and call it just prior to assemble().
This commit is contained in:
Bård Skaflestad
2011-10-06 14:54:02 +02:00
parent 711e59df4c
commit 255a0cf6ee

View File

@@ -66,7 +66,8 @@ namespace Opm {
class JacobianSystem ,
template <class> class VNorm ,
template <class> class VNeg ,
template <class> class VZero >
template <class> class VZero ,
template <class> class MZero >
class ImplicitTransport {
public:
ImplicitTransport(Model& model)
@@ -87,14 +88,16 @@ namespace Opm {
ImplicitTransportDetails::NRReport& rpt ) {
typedef typename JacobianSystem::vector_type vector_type;
typedef typename JacobianSystem::matrix_type matrix_type;
asm_.createSystem(g, sys_);
VZero<vector_type>::zero(sys_.vector().writableResidual());
model_.initStep(state, g, sys_);
model_.initIteration(state, g, sys_);
MZero<matrix_type>::zero(sys_.writableMatrix());
VZero<vector_type>::zero(sys_.vector().writableResidual());
asm_.assemble(state, g, src, dt, sys_);
const double nrm_res0 =
@@ -121,6 +124,9 @@ namespace Opm {
sys_.vector().addIncrement();
model_.initIteration(state, g, sys_);
MZero<matrix_type>::zero(sys_.writableMatrix());
VZero<vector_type>::zero(sys_.vector().writableResidual());
asm_.assemble(state, g, src, dt, sys_);
rpt.norm_res =
VNorm<vector_type>::norm(sys_.vector().residual());