diff --git a/src/elasticity/assemble/IElasticity.hpp b/src/elasticity/assemble/IElasticity.hpp index 4dd180902aa6369ca6e2985703530efa35489181..0468904cd64bf8b4144120bcb85739d44f290911 100644 --- a/src/elasticity/assemble/IElasticity.hpp +++ b/src/elasticity/assemble/IElasticity.hpp @@ -77,8 +77,9 @@ public: double Residual(const Vector &u, Vector &r) const override { r = *Prestress; r = 0; - for (cell ce = u.cells(); ce != u.cells_end(); ++ce) + for (cell ce = u.cells(); ce != u.cells_end(); ++ce) { Residual(ce, u, r); + } r.ClearDirichletValues(); r.Collect(); return r.norm(); @@ -101,8 +102,9 @@ public: /// Calculates the residual including viscous part. virtual double ViscoResidual(const Vector &u, const Vector &v, Vector &defect) const { defect = *Prestress; + defect = 0; TRY { - for (cell ce = v.cells(); ce != v.cells_end(); ++ce) + for (cell ce = u.cells(); ce != u.cells_end(); ++ce) ViscoResidual(ce, u, v, defect); } CATCH ("Error in Residual") defect.ClearDirichletValues();