From 0b711e6758b0ba3732b2e6cfceb009aa186e525e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastia=CC=81n=20Barschkis?= Date: Wed, 13 Jan 2021 09:49:11 +0100 Subject: Fluid: Updated Mantaflow source files Includes minor fixes / cleanups from the viscosity plugin. --- extern/mantaflow/preprocessed/conjugategrad.h | 16 ++++++++-------- extern/mantaflow/preprocessed/plugin/viscosity.cpp | 12 +++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/extern/mantaflow/preprocessed/conjugategrad.h b/extern/mantaflow/preprocessed/conjugategrad.h index 4974aa6a4d6..35cb3960656 100644 --- a/extern/mantaflow/preprocessed/conjugategrad.h +++ b/extern/mantaflow/preprocessed/conjugategrad.h @@ -170,7 +170,7 @@ struct ApplyMatrix : public KernelBase { unusedParameter(vecRhs); // Not needed in this matrix application if (matrixA.size() != 4) - errMsg("ConjugatedGrad: Invalid A matrix in apply matrix step"); + errMsg("ConjugateGrad: Invalid A matrix in apply matrix step"); Grid &A0 = *matrixA[0]; Grid &Ai = *matrixA[1]; Grid &Aj = *matrixA[2]; @@ -256,7 +256,7 @@ struct ApplyMatrix2D : public KernelBase { unusedParameter(vecRhs); // Not needed in this matrix application if (matrixA.size() != 3) - errMsg("ConjugatedGrad: Invalid A matrix in apply matrix step"); + errMsg("ConjugateGrad: Invalid A matrix in apply matrix step"); Grid &A0 = *matrixA[0]; Grid &Ai = *matrixA[1]; Grid &Aj = *matrixA[2]; @@ -338,7 +338,7 @@ struct ApplyMatrixViscosityU : public KernelBase { const std::vector *> vecRhs) const { if (matrixA.size() != 15) - errMsg("ConjugatedGrad: Invalid A matrix in apply matrix step"); + errMsg("ConjugateGrad: Invalid A matrix in apply matrix step"); Grid &A0 = *matrixA[0]; Grid &Aplusi = *matrixA[1]; Grid &Aplusj = *matrixA[2]; @@ -348,7 +348,7 @@ struct ApplyMatrixViscosityU : public KernelBase { Grid &Aminusk = *matrixA[6]; if (vecRhs.size() != 2) - errMsg("ConjugatedGrad: Invalid rhs vector in apply matrix step"); + errMsg("ConjugateGrad: Invalid rhs vector in apply matrix step"); Grid &srcV = *vecRhs[0]; Grid &srcW = *vecRhs[1]; @@ -450,7 +450,7 @@ struct ApplyMatrixViscosityV : public KernelBase { const std::vector *> vecRhs) const { if (matrixA.size() != 15) - errMsg("ConjugatedGrad: Invalid A matrix in apply matrix step"); + errMsg("ConjugateGrad: Invalid A matrix in apply matrix step"); Grid &A0 = *matrixA[0]; Grid &Aplusi = *matrixA[1]; Grid &Aplusj = *matrixA[2]; @@ -460,7 +460,7 @@ struct ApplyMatrixViscosityV : public KernelBase { Grid &Aminusk = *matrixA[6]; if (vecRhs.size() != 2) - errMsg("ConjugatedGrad: Invalid rhs vector in apply matrix step"); + errMsg("ConjugateGrad: Invalid rhs vector in apply matrix step"); Grid &srcU = *vecRhs[0]; Grid &srcW = *vecRhs[1]; @@ -562,7 +562,7 @@ struct ApplyMatrixViscosityW : public KernelBase { const std::vector *> vecRhs) const { if (matrixA.size() != 15) - errMsg("ConjugatedGrad: Invalid A matrix in apply matrix step"); + errMsg("ConjugateGrad: Invalid A matrix in apply matrix step"); Grid &A0 = *matrixA[0]; Grid &Aplusi = *matrixA[1]; Grid &Aplusj = *matrixA[2]; @@ -572,7 +572,7 @@ struct ApplyMatrixViscosityW : public KernelBase { Grid &Aminusk = *matrixA[6]; if (vecRhs.size() != 2) - errMsg("ConjugatedGrad: Invalid rhs vector in apply matrix step"); + errMsg("ConjugateGrad: Invalid rhs vector in apply matrix step"); Grid &srcU = *vecRhs[0]; Grid &srcV = *vecRhs[1]; diff --git a/extern/mantaflow/preprocessed/plugin/viscosity.cpp b/extern/mantaflow/preprocessed/plugin/viscosity.cpp index 5dc478b13dd..a9e1985336e 100644 --- a/extern/mantaflow/preprocessed/plugin/viscosity.cpp +++ b/extern/mantaflow/preprocessed/plugin/viscosity.cpp @@ -139,7 +139,7 @@ struct KnEstimateVolumeFraction : public KernelBase { { const Vec3 centre = startCentre + Vec3(i, j, k) * 0.5; const Real offset = 0.5 * dx; - const int order = 2; + const int order = 1; // is sufficient Real phi000 = phi.getInterpolatedHi(centre + Vec3(-offset, -offset, -offset), order); Real phi001 = phi.getInterpolatedHi(centre + Vec3(-offset, -offset, +offset), order); @@ -1067,10 +1067,8 @@ void solveViscosity(const FlagGrid &flags, Real viscTop = 0.25 * (viscosity(i, j, k) + viscosity(i, j, k - 1) + viscosity(i, j + 1, k) + viscosity(i, j + 1, k - 1)); - ; Real viscBottom = 0.25 * (viscosity(i, j, k) + viscosity(i, j, k - 1) + viscosity(i, j - 1, k) + viscosity(i, j - 1, k - 1)); - ; Real volTop = exVolLiquid(i, j + 1, k); Real volBottom = exVolLiquid(i, j, k); @@ -1224,7 +1222,7 @@ void solveViscosity(const FlagGrid &flags, uSolution, uRhs, uResidual, uSearch, flags, uTmp, uMatA, uVecRhs); } else { - errMsg("2D Matrix application not yet supported in viscosity solver"); + errMsg("Viscosity: 2D Matrix application not yet supported in viscosity solver"); } // CG solver for V @@ -1249,7 +1247,7 @@ void solveViscosity(const FlagGrid &flags, vSolution, vRhs, vResidual, vSearch, flags, vTmp, vMatA, vVecRhs); } else { - errMsg("2D Matrix application not yet supported in viscosity solver"); + errMsg("Viscosity: 2D Matrix application not yet supported in viscosity solver"); } // CG solver for W @@ -1274,7 +1272,7 @@ void solveViscosity(const FlagGrid &flags, wSolution, wRhs, wResidual, wSearch, flags, wTmp, wMatA, wVecRhs); } else { - errMsg("2D Matrix application not yet supported in viscosity solver"); + errMsg("Viscosity: 2D Matrix application not yet supported in viscosity solver"); } // Same accuracy for all dimensions @@ -1308,7 +1306,7 @@ void solveViscosity(const FlagGrid &flags, wRhs.copyFrom(wSearch); } debMsg( - "Viscosity::solveViscosity done. " + "Viscosity: solveViscosity() done. " "Iterations (u,v,w): (" << uGcg->getIterations() << "," << vGcg->getIterations() << "," << wGcg->getIterations() << "), " -- cgit v1.2.3