diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-03-07 21:56:51 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-03-07 21:57:06 +0300 |
commit | 5539b68009e6936238c060808b874e6a6e86a073 (patch) | |
tree | d69c01c61986d6afce88e49596bed66f903da96f | |
parent | 9867a82072bb7d4394cbe8679b6c73d4ae209dbe (diff) |
Fluid: Optimization for smoke simulation (multigrid)
The solver will now automatically detect static scenes (no moving obstacles) and use a slightly faster pressure solve in those cases.
-rw-r--r-- | extern/mantaflow/preprocessed/gitinfo.h | 2 | ||||
-rw-r--r-- | extern/mantaflow/preprocessed/plugin/pressure.cpp | 5 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/smoke_script.h | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index 29a9158d5c3..48bb85c8479 100644 --- a/extern/mantaflow/preprocessed/gitinfo.h +++ b/extern/mantaflow/preprocessed/gitinfo.h @@ -1,3 +1,3 @@ -#define MANTA_GIT_VERSION "commit 1d52e96ad602f1974dfee75bef293bc397e4b41b" +#define MANTA_GIT_VERSION "commit 1d55979473c25318f39c4a6bf48a5ab77b3bf39b" diff --git a/extern/mantaflow/preprocessed/plugin/pressure.cpp b/extern/mantaflow/preprocessed/plugin/pressure.cpp index 7def2669e36..780ba44a2b5 100644 --- a/extern/mantaflow/preprocessed/plugin/pressure.cpp +++ b/extern/mantaflow/preprocessed/plugin/pressure.cpp @@ -1171,6 +1171,11 @@ void solvePressureSystem(Grid<Real> &rhs, maxIter = 100; pmg = gMapMG[parent]; + // Release MG from previous step if present (e.g. if previous solve was with MGStatic) + if (pmg && preconditioner == PcMGDynamic) { + releaseMG(parent); + pmg = nullptr; + } if (!pmg) { pmg = new GridMg(pressure.getSize()); gMapMG[parent] = pmg; diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h index 7a6a2a6d7bf..fb2eaa9b441 100644 --- a/intern/mantaflow/intern/strings/smoke_script.h +++ b/intern/mantaflow/intern/strings/smoke_script.h @@ -30,7 +30,7 @@ const std::string smoke_variables = "\n\ mantaMsg('Smoke variables low')\n\ -preconditioner_s$ID$ = PcMGDynamic\n\ +preconditioner_s$ID$ = PcMGStatic\n\ using_colors_s$ID$ = $USING_COLORS$\n\ using_heat_s$ID$ = $USING_HEAT$\n\ using_fire_s$ID$ = $USING_FIRE$\n\ @@ -391,6 +391,8 @@ def smoke_step_$ID$():\n\ mantaMsg('Walls')\n\ setWallBcs(flags=flags_s$ID$, vel=vel_s$ID$, obvel=obvel_s$ID$ if using_obstacle_s$ID$ else None)\n\ \n\ + preconditioner_s$ID$ = PcMGDynamic if using_obstacle_s$ID$ and obvel_s$ID$.getMax() > 0 else PcMGStatic\n\ + mantaMsg('Using preconditioner: ' + str(preconditioner_s$ID$))\n\ if using_guiding_s$ID$:\n\ mantaMsg('Guiding and pressure')\n\ PD_fluid_guiding(vel=vel_s$ID$, velT=velT_s$ID$, flags=flags_s$ID$, weight=weightGuide_s$ID$, blurRadius=beta_sg$ID$, pressure=pressure_s$ID$, tau=tau_sg$ID$, sigma=sigma_sg$ID$, theta=theta_sg$ID$, preconditioner=preconditioner_s$ID$, zeroPressureFixing=not doOpen_s$ID$)\n\ |