From 6a9d30e7066296bf3cc1babc632d07d3c93941d1 Mon Sep 17 00:00:00 2001
From: Kutalmis Bercin <kutalmis.bercin@esi-group.com>
Date: Thu, 17 Dec 2020 12:04:30 +0000
Subject: [PATCH] BUG: solverInfo: ensure access to initial residual fields
 (#1452)

Prior to the commit, initial residual fields were registered by
the `setResidualField()` function of a linear solver with a field name
prefixed by `residual:`. However, `solverInfo` FO could only access to
the initial residual fields prefixed by `initialResidual:`.

Due to this discrepancy, using `solverInfo` FO with `writeResidualFields=true`
option was resulting in empty residual fields to be output.
---
 src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C           | 2 +-
 src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.C               | 2 +-
 .../matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C b/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C
index da8cd4598af..cba20eba933 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C
@@ -105,7 +105,7 @@ Foam::solverPerformance Foam::PBiCG::solve
     (
         ConstPrecisionAdaptor<scalar, solveScalar>(rA)(),
         fieldName_,
-        false
+        true
     );
 
     // --- Calculate normalisation factor
diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.C b/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.C
index e4802499662..2b34a6aad37 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.C
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/PCG/PCG.C
@@ -104,7 +104,7 @@ Foam::solverPerformance Foam::PCG::scalarSolve
     (
         ConstPrecisionAdaptor<scalar, solveScalar>(rA)(),
         fieldName_,
-        false
+        true
     );
 
     // --- Calculate normalisation factor
diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C
index 6296dacd6ad..78e6a7c62d8 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/smoothSolver/smoothSolver.C
@@ -140,7 +140,7 @@ Foam::solverPerformance Foam::smoothSolver::solve
             (
                 ConstPrecisionAdaptor<scalar, solveScalar>(residual)(),
                 fieldName_,
-                false
+                true
             );
 
             // Calculate residual magnitude
-- 
GitLab