Commit e7bf2b60 authored by Simone Bnà's avatar Simone Bnà

BUG: Use ctx.performance instead of local solverPerf (fixes #13)

parent b3e26ed0
......@@ -230,6 +230,9 @@ Foam::solverPerformance Foam::petscSolver::scalarSolve
fieldName_
);
// Retain copy of solverPerformance
ctx.performance = solverPerf;
// Create solution and rhs vectors for PETSc
// We could create these once, and call PlaceArray/ResetArray instead
PetscWrappedVector petsc_psi(psi, Amat);
......@@ -247,7 +250,7 @@ Foam::solverPerformance Foam::petscSolver::scalarSolve
if (usePetscResidualNorm)
{
// Add monitor to record initial residual
solverPerf.initialResidual() = 0;
ctx.performance.initialResidual() = 0;
KSPMonitorSet
(
ksp,
......@@ -293,22 +296,19 @@ Foam::solverPerformance Foam::petscSolver::scalarSolve
// Set nIterations and final residual
PetscInt nIters;
KSPGetIterationNumber(ksp, &nIters);
solverPerf.nIterations() = nIters;
ctx.performance.nIterations() = nIters;
if (usePetscResidualNorm)
{
PetscReal rnorm;
KSPGetResidualNorm(ksp, &rnorm);
solverPerf.finalResidual() = rnorm;
ctx.performance.finalResidual() = rnorm;
}
// Retain copy of solverPerformance
ctx.performance = solverPerf;
ctx.caching.eventEnd();
// Return solver performance to OpenFOAM
return solverPerf;
return ctx.performance;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment