[Bf-blender-cvs] [90ec9b40263] fluid-mantaflow: disabling fractions and enabling moving obstacles again

Sebastián Barschkis noreply at git.blender.org
Sun Oct 8 12:22:56 CEST 2017


Commit: 90ec9b4026379f3383c7abd829815082148997f8
Author: Sebastián Barschkis
Date:   Fri Oct 6 13:21:38 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB90ec9b4026379f3383c7abd829815082148997f8

disabling fractions and enabling moving obstacles again

fractions do not support moving obstacles right now. also, fractions combined with obstacles results in particle leak (likely because of inaccuracies at fluid/obs border when repeatedly subtracting from phi grid - sdf not preserved)

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

M	intern/mantaflow/intern/manta_pp/omp/fastmarch.cpp
M	intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
M	intern/mantaflow/intern/manta_pp/tbb/fastmarch.cpp
M	intern/mantaflow/intern/manta_pp/tbb/plugin/extforces.cpp
M	intern/mantaflow/intern/strings/liquid_script.h
M	intern/mantaflow/intern/strings/smoke_script.h

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

diff --git a/intern/mantaflow/intern/manta_pp/omp/fastmarch.cpp b/intern/mantaflow/intern/manta_pp/omp/fastmarch.cpp
index 3214d52bade..974b967a70e 100644
--- a/intern/mantaflow/intern/manta_pp/omp/fastmarch.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/fastmarch.cpp
@@ -369,7 +369,7 @@ inline Vec3 getNormal(const Grid<Real>& data, int i, int j, int k) {
 // only fluid velocities, not those at obstacles)
 
 
-void extrapolateMACSimple(FlagGrid& flags, MACGrid& vel, int distance = 4, LevelsetGrid* phiObs=NULL , bool intoObs = false, Grid<Real>* exclude=NULL ) {
+void extrapolateMACSimple(FlagGrid& flags, MACGrid& vel, int distance = 4, LevelsetGrid* phiObs=NULL , bool intoObs = false ) {
 	Grid<int> tmp( flags.getParent() );
 	int dim = (flags.is3D() ? 3:2);
 
@@ -404,7 +404,7 @@ void extrapolateMACSimple(FlagGrid& flags, MACGrid& vel, int distance = 4, Level
 
 	// copy tangential values into sides
 	knExtrapolateIntoBnd(flags, vel);
-} static PyObject* _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "extrapolateMACSimple" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",1,&_lock); int distance = _args.getOpt<int >("distance",2,4,&_lo [...]
+} static PyObject* _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "extrapolateMACSimple" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",1,&_lock); int distance = _args.getOpt<int >("distance",2,4,&_lo [...]
 
 
 
diff --git a/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp b/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
index 02e5f3a0904..c894385b708 100644
--- a/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/plugin/extforces.cpp
@@ -446,7 +446,7 @@ void setInflowBcs(MACGrid& vel, string dir, Vec3 value) {
 //! set zero normal velocity boundary condition on walls
 // (optionally with second order accuracy using the obstacle SDF , fractions grid currentlyl not needed)
 void setWallBcs(FlagGrid& flags, MACGrid& vel, MACGrid* obvel = 0, MACGrid* fractions = 0, Grid<Real>* phiObs = 0, int boundaryWidth=0) {
-	if(!phiObs) {
+	if(!phiObs || !fractions) {
 		KnSetWallBcs(flags, vel, obvel);
 	} else {
 		MACGrid tmpvel(vel.getParent());
diff --git a/intern/mantaflow/intern/manta_pp/tbb/fastmarch.cpp b/intern/mantaflow/intern/manta_pp/tbb/fastmarch.cpp
index a937c181301..74089a69719 100644
--- a/intern/mantaflow/intern/manta_pp/tbb/fastmarch.cpp
+++ b/intern/mantaflow/intern/manta_pp/tbb/fastmarch.cpp
@@ -347,7 +347,7 @@ inline Vec3 getNormal(const Grid<Real>& data, int i, int j, int k) {
 // only fluid velocities, not those at obstacles)
 
 
-void extrapolateMACSimple(FlagGrid& flags, MACGrid& vel, int distance = 4, LevelsetGrid* phiObs=NULL , bool intoObs = false, Grid<Real>* exclude=NULL ) {
+void extrapolateMACSimple(FlagGrid& flags, MACGrid& vel, int distance = 4, LevelsetGrid* phiObs=NULL , bool intoObs = false ) {
 	Grid<int> tmp( flags.getParent() );
 	int dim = (flags.is3D() ? 3:2);
 
@@ -382,7 +382,7 @@ void extrapolateMACSimple(FlagGrid& flags, MACGrid& vel, int distance = 4, Level
 
 	// copy tangential values into sides
 	knExtrapolateIntoBnd(flags, vel);
-} static PyObject* _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "extrapolateMACSimple" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",1,&_lock); int distance = _args.getOpt<int >("distance",2,4,&_lo [...]
+} static PyObject* _W_0 (PyObject* _self, PyObject* _linargs, PyObject* _kwds) { try { PbArgs _args(_linargs, _kwds); FluidSolver *parent = _args.obtainParent(); bool noTiming = _args.getOpt<bool>("notiming", -1, 0); pbPreparePlugin(parent, "extrapolateMACSimple" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",0,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",1,&_lock); int distance = _args.getOpt<int >("distance",2,4,&_lo [...]
 
 
 
diff --git a/intern/mantaflow/intern/manta_pp/tbb/plugin/extforces.cpp b/intern/mantaflow/intern/manta_pp/tbb/plugin/extforces.cpp
index bf46f9c3034..3fc7ff40aa2 100644
--- a/intern/mantaflow/intern/manta_pp/tbb/plugin/extforces.cpp
+++ b/intern/mantaflow/intern/manta_pp/tbb/plugin/extforces.cpp
@@ -362,7 +362,7 @@ void setInflowBcs(MACGrid& vel, string dir, Vec3 value) {
 //! set zero normal velocity boundary condition on walls
 // (optionally with second order accuracy using the obstacle SDF , fractions grid currentlyl not needed)
 void setWallBcs(FlagGrid& flags, MACGrid& vel, MACGrid* obvel = 0, MACGrid* fractions = 0, Grid<Real>* phiObs = 0, int boundaryWidth=0) {
-	if(!phiObs) {
+	if(!phiObs || !fractions) {
 		KnSetWallBcs(flags, vel, obvel);
 	} else {
 		MACGrid tmpvel(vel.getParent());
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h
index 299c6c1a76b..b59416247ff 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -64,7 +64,7 @@ phiOutIn_s$ID$   = s$ID$.create(LevelsetGrid)\n\
 pressure_s$ID$   = s$ID$.create(RealGrid)\n\
 \n\
 phiObs_s$ID$     = s$ID$.create(LevelsetGrid)\n\
-fractions_s$ID$  = s$ID$.create(MACGrid)\n\
+fractions_s$ID$  = 0 # s$ID$.create(MACGrid) # TODO (sebbas): disabling fractions for now - not fracwallbcs not supporting obvels yet\n\
 \n\
 vel_s$ID$        = s$ID$.create(MACGrid)\n\
 x_vel_s$ID$      = s$ID$.create(RealGrid)\n\
@@ -115,6 +115,7 @@ def liquid_pre_step_low_$ID$():\n\
         x_obvel_s$ID$.multConst(gs_s$ID$.x)\n\
         y_obvel_s$ID$.multConst(gs_s$ID$.y)\n\
         z_obvel_s$ID$.multConst(gs_s$ID$.z)\n\
+        copyRealToVec3(sourceX=x_obvel_s$ID$, sourceY=y_obvel_s$ID$, sourceZ=z_obvel_s$ID$, target=obvelC_s$ID$)\n\
     \n\
     # translate guiding vels (world space) to grid space\n\
     if using_guiding_s$ID$:\n\
@@ -131,10 +132,7 @@ def liquid_pre_step_low_$ID$():\n\
         copyRealToVec3(sourceX=x_invel_s$ID$, sourceY=y_invel_s$ID$, sourceZ=z_invel_s$ID$, target=invel_s$ID$)\n\
     \n\
     copyRealToVec3(sourceX=x_vel_s$ID$, sourceY=y_vel_s$ID$, sourceZ=z_vel_s$ID$, target=vel_s$ID$)\n\
-    copyRealToVec3(sourceX=x_force_s$ID$, sourceY=y_force_s$ID$, sourceZ=z_force_s$ID$, target=forces_s$ID$)\n\
-    \n\
-    if using_obstacle_s$ID$:\n\
-        copyRealToVec3(sourceX=x_obvel_s$ID$, sourceY=y_obvel_s$ID$, sourceZ=z_obvel_s$ID$, target=obvelC_s$ID$)\n";
+    copyRealToVec3(sourceX=x_force_s$ID$, sourceY=y_force_s$ID$, sourceZ=z_force_s$ID$, target=forces_s$ID$)\n";
 
 const std::string liquid_post_step_low = "\n\
 def liquid_post_step_low_$ID$():\n\
@@ -181,7 +179,7 @@ def manta_step_$ID$(framenr):\n\
         \n\
         phiOut_s$ID$.join(phiOutIn_s$ID$)\n\
         \n\
-        updateFractions(flags=flags_s$ID$, phiObs=phiObs_s$ID$, fractions=fractions_s$ID$, boundaryWidth=boundaryWidth_s$ID$)\n\
+        #updateFractions(flags=flags_s$ID$, phiObs

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list