From 6f22a536e690133f7b7f9e62e6affd58d5ee2b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastia=CC=81n=20Barschkis?= Date: Sun, 6 Dec 2020 21:56:43 +0100 Subject: Fluid: Updated Mantaflow source files Includes outflow optimization - might have been the cause of instabilities. --- extern/mantaflow/preprocessed/gitinfo.h | 2 +- extern/mantaflow/preprocessed/plugin/advection.cpp | 8 ++++---- extern/mantaflow/preprocessed/plugin/pressure.cpp | 14 +++----------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index d7a69564a3b..a0590e6a0b0 100644 --- a/extern/mantaflow/preprocessed/gitinfo.h +++ b/extern/mantaflow/preprocessed/gitinfo.h @@ -1,3 +1,3 @@ -#define MANTA_GIT_VERSION "commit bb7cde47b6e04fa62815c70775dc70f02065599f" +#define MANTA_GIT_VERSION "commit 327917cd59b03bef3a953b5f58fc1637b3a83e01" diff --git a/extern/mantaflow/preprocessed/plugin/advection.cpp b/extern/mantaflow/preprocessed/plugin/advection.cpp index 4ccf33cc362..dd891e22088 100644 --- a/extern/mantaflow/preprocessed/plugin/advection.cpp +++ b/extern/mantaflow/preprocessed/plugin/advection.cpp @@ -1090,8 +1090,8 @@ struct extrapolateVelConvectiveBC : public KernelBase { Real timeStep) const { if (flags.isOutflow(i, j, k)) { - Vec3 bulkVel = getBulkVel(flags, vel, i, j, k); - int dim = flags.is3D() ? 3 : 2; + const Vec3 bulkVel = getBulkVel(flags, vel, i, j, k); + const int dim = flags.is3D() ? 3 : 2; const Vec3i cur = Vec3i(i, j, k); Vec3i low, up, flLow, flUp; int cnt = 0; @@ -1099,8 +1099,8 @@ struct extrapolateVelConvectiveBC : public KernelBase { for (int c = 0; c < dim; c++) { low = up = flLow = flUp = cur; Real factor = timeStep * - max((Real)1.0, bulkVel[c]); // prevent the extrapolated velocity from - // exploding when bulk velocity below 1 + max((Real)1.0, abs(bulkVel[c])); // prevent the extrapolated velocity from + // exploding when bulk velocity below 1 low[c] = flLow[c] = cur[c] - 1; up[c] = flUp[c] = cur[c] + 1; // iterate over bWidth to allow for extrapolation into more distant outflow cells; diff --git a/extern/mantaflow/preprocessed/plugin/pressure.cpp b/extern/mantaflow/preprocessed/plugin/pressure.cpp index dfba8e0082b..1100a58db47 100644 --- a/extern/mantaflow/preprocessed/plugin/pressure.cpp +++ b/extern/mantaflow/preprocessed/plugin/pressure.cpp @@ -1147,26 +1147,18 @@ void solvePressureSystem(Grid &rhs, gcg->setAccuracy(cgAccuracy); gcg->setUseL2Norm(useL2Norm); - int maxIter = 0; + int maxIter = (int)(cgMaxIterFac * flags.getSize().max()) * (flags.is3D() ? 1 : 4); Grid *pca0 = nullptr, *pca1 = nullptr, *pca2 = nullptr, *pca3 = nullptr; GridMg *pmg = nullptr; // optional preconditioning - if (preconditioner == PcNone || preconditioner == PcMIC) { - maxIter = (int)(cgMaxIterFac * flags.getSize().max()) * (flags.is3D() ? 1 : 4); - + if (preconditioner == PcMIC) { pca0 = new Grid(parent); pca1 = new Grid(parent); pca2 = new Grid(parent); pca3 = new Grid(parent); - - gcg->setICPreconditioner(preconditioner == PcMIC ? GridCgInterface::PC_mICP : - GridCgInterface::PC_None, - pca0, - pca1, - pca2, - pca3); + gcg->setICPreconditioner(GridCgInterface::PC_mICP, pca0, pca1, pca2, pca3); } else if (preconditioner == PcMGDynamic || preconditioner == PcMGStatic) { maxIter = 100; -- cgit v1.2.3