From b8add08563eec4c36ae83b17c48a9e5768750e88 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 16 Oct 2023 10:46:44 +0200 Subject: [PATCH] StabilizationUtils::getTauPt: use matrix::norm2() --- Apps/Common/StabilizationUtils.C | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Apps/Common/StabilizationUtils.C b/Apps/Common/StabilizationUtils.C index 996ca0fb..87521a82 100644 --- a/Apps/Common/StabilizationUtils.C +++ b/Apps/Common/StabilizationUtils.C @@ -41,12 +41,9 @@ double getElementSize (const std::vector& XC, int nsd) double getTauPt (double dt, double mu, const Vector& U, const Matrix& G, const double Ct, const double Cl) { - double Gnorm2 = 0.0; - for (size_t i = 1;i <= G.rows();i++) - for (size_t j = 1;j <= G.cols();j++) - Gnorm2 += G(i,j)*G(i,j); - - return 1.0/sqrt( Ct/pow(dt,2) + U.dot(G*U) + Cl*mu*mu*Gnorm2); + double Gnorm2 = G.norm2(); + Gnorm2 *= Gnorm2; + return 1.0/ sqrt(Ct/pow(dt,2) + U.dot(G*U) + Cl*mu*mu*Gnorm2); }