StabilizationUtils::getTauPt:

use matrix::norm2()
This commit is contained in:
Arne Morten Kvarving
2023-10-16 10:46:44 +02:00
parent 40508f0e12
commit b8add08563

View File

@@ -41,12 +41,9 @@ double getElementSize (const std::vector<Vec3>& 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);
}