Commit: 5539b68009e6936238c060808b874e6a6e86a073
Author: Sebastián Barschkis
Date:   Sat Mar 7 19:56:51 2020 +0100
Branches: master
https://developer.blender.org/rB5539b68009e6936238c060808b874e6a6e86a073

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.

===================================================================

M       extern/mantaflow/preprocessed/gitinfo.h
M       extern/mantaflow/preprocessed/plugin/pressure.cpp
M       intern/mantaflow/intern/strings/smoke_script.h

===================================================================

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\

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to