From 0bde511370c4153e2e0b8ba3bbaa705e20ea87a0 Mon Sep 17 00:00:00 2001
From: Paul Dechamps <paul.dechamps@uliege.be>
Date: Tue, 27 Feb 2024 18:19:25 +0100
Subject: [PATCH] (fix) Security check in blowing velocity computation

Now the velocity value is checked for possible nan.
---
 blast/src/DBoundaryLayer.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/blast/src/DBoundaryLayer.cpp b/blast/src/DBoundaryLayer.cpp
index 9886a79..804d780 100644
--- a/blast/src/DBoundaryLayer.cpp
+++ b/blast/src/DBoundaryLayer.cpp
@@ -157,6 +157,10 @@ void BoundaryLayer::computeBlwVel()
         blowingVelocity[iPoint - 1] = (blEdge->getRhoe(iPoint) * blEdge->getVt(iPoint) * deltaStar[iPoint] - blEdge->getRhoe(iPoint - 1) * blEdge->getVt(iPoint - 1) * deltaStar[iPoint - 1]) / (blEdge->getRhoe(iPoint) * (mesh->getLoc(iPoint) - mesh->getLoc(iPoint - 1)));
         if (std::isnan(blowingVelocity[iPoint - 1]))
         {
+            if (std::isnan(blEdge->getVt(iPoint)))
+                std::cout << "Velocity is nan at position " << iPoint << std::endl;
+            if (std::isnan(blEdge->getVt(iPoint-1)))
+                std::cout << "Velocity is nan at position " << iPoint-1 << std::endl;
             if (blEdge->getRhoe(iPoint) == 0.)
                 std::cout << "Density is zero at point " << iPoint << std::endl;
             if ((mesh->getLoc(iPoint) - mesh->getLoc(iPoint - 1)) == 0.)
-- 
GitLab