From 889b8dcd4ca11b64dfa79f79e9c1222e23e258a9 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Wed, 7 Feb 2018 13:28:47 +0100 Subject: [PATCH] Fixed storing every residual in solvePerformance (increasing solverPerformance list size). Significant influence on speed when running with large number of correctors (i.e. solidMechanics) --- src/foam/matrices/solution/solution.C | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/foam/matrices/solution/solution.C b/src/foam/matrices/solution/solution.C index 90732e0b2..7721094c9 100644 --- a/src/foam/matrices/solution/solution.C +++ b/src/foam/matrices/solution/solution.C @@ -442,8 +442,18 @@ void Foam::solution::setSolverPerformance solverPerformance_.readIfPresent(name, perfs); } - // Append to list - perfs.setSize(perfs.size() + 1, sp); + // Only the first iteration and the current iteration residuals are + // required, so the current iteration residual replaces the previous one and + // only the first iteration is always present, VS 2017-11-27 + if (perfs.size() < 2) + { + // Append to list + perfs.setSize(perfs.size() + 1, sp); + } + else + { + perfs.last() = sp; + } solverPerformance_.set(name, perfs); }