From c20a2ce60004cfa0967c9587f977ef2319860dd3 Mon Sep 17 00:00:00 2001
From: zy69guqi <richard.angersbach@fau.de>
Date: Wed, 9 Aug 2023 15:19:31 +0200
Subject: [PATCH] Compute init res in poisson solver ctor

---
 .../ChargedParticles/poisson_solver/PoissonSolver.h       | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/apps/showcases/ChargedParticles/poisson_solver/PoissonSolver.h b/apps/showcases/ChargedParticles/poisson_solver/PoissonSolver.h
index 02cd33b7d..e0c1d5906 100644
--- a/apps/showcases/ChargedParticles/poisson_solver/PoissonSolver.h
+++ b/apps/showcases/ChargedParticles/poisson_solver/PoissonSolver.h
@@ -97,6 +97,12 @@ class PoissonSolver
          sorFixedSweep_->getBlackSweep(), *residualNorm_, residualNormThreshold, residualCheckFrequency);
 
       sorIteration_->addBoundaryHandling(boundaryHandling);
+
+      // compute initial residual and print
+      boundaryHandling_();
+      (*commScheme_)();
+      initRes_ = (*residualNorm_)();
+      WALBERLA_LOG_INFO_ON_ROOT("Initial residual = " << initRes_);
    }
 
    // get approximate solution of electric potential
@@ -126,6 +132,8 @@ class PoissonSolver
 
    std::shared_ptr< pde::SORFixedStencil< Stencil_T > > sorFixedSweep_;
    std::unique_ptr< pde::RBGSIteration > sorIteration_;
+
+   real_t initRes_;
 };
 
 } // namespace walberla
-- 
GitLab