[Bf-blender-cvs] [91ef5780c90] fluid-mantaflow: re-enabled bubble rise factor and some small snd particles fixes
Sebastián Barschkis
noreply at git.blender.org
Sat Nov 11 13:08:18 CET 2017
Commit: 91ef5780c9075ddec2180515cc9b308038b97064
Author: Sebastián Barschkis
Date: Wed Nov 8 17:26:18 2017 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rB91ef5780c9075ddec2180515cc9b308038b97064
re-enabled bubble rise factor and some small snd particles fixes
===================================================================
M intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
M intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
M intern/mantaflow/intern/strings/liquid_script.h
M release/scripts/startup/bl_ui/properties_physics_smoke.py
===================================================================
diff --git a/intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp b/intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
index 49e74c06aa0..381d4fd32c6 100644
--- a/intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
+++ b/intern/mantaflow/intern/manta_pp/omp/plugin/flip.cpp
@@ -811,11 +811,9 @@ void adjustSndParts(BasicParticleSystem& parts, FlagGrid& flags, LevelsetGrid& p
//! update velocities. set new particle position. optional: convert between particle types, partLife update
-void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravity, BasicParticleSystem& parts, ParticleDataImpl<Vec3>& partVel, ParticleDataImpl<int>* partLife=NULL) {
+void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravity, BasicParticleSystem& parts, ParticleDataImpl<Vec3>& partVel, ParticleDataImpl<int>* partLife=NULL, Real bubbleRise=0.5) {
RandomStream mRand(9832);
- Real coefficient = 0.5;
Vec3 grav = gravity * flags.getParent()->getDt() / flags.getParent()->getDx();
- Vec3 buoyancy = (-1) * grav * coefficient;
const Real DROP_THRESH = 0.866;
// Insert buffered particles now. In sampleSndParts() we buffered them.
@@ -839,6 +837,7 @@ void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravi
partVel[idx] += grav;
}
else if (parts.isBubble(idx)) {
+ Vec3 buoyancy = (-1) * grav * bubbleRise;
Vec3 randomVel = vel.getInterpolated( parts[idx].pos ) * mRand.getFloat(0.25, 0.5);
partVel[idx] += buoyancy + randomVel;
}
@@ -864,6 +863,7 @@ void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravi
}
// Get phiv for current and next particle position
+ pos = parts.getPos(idx);
const Vec3 pos2 = pos + partVel[idx] * dt;
Real phiv = phi.getInterpolated(pos);
Real phiv2 = phi.getInterpolated(pos2);
@@ -876,7 +876,7 @@ void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravi
parts.setStatus(idx, ParticleBase::PNEW | ParticleBase::PFLOATER);
}
}
-} static PyObject* _W_21 (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, "updateSndParts" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; LevelsetGrid& phi = *_args.getPtr<LevelsetGrid >("phi",0,&_lock); FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",1,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",2,& [...]
+} static PyObject* _W_21 (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, "updateSndParts" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; LevelsetGrid& phi = *_args.getPtr<LevelsetGrid >("phi",0,&_lock); FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",1,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",2,& [...]
//! sample new particles of given type. control amount of particles with constraint and number of samples per cell
@@ -896,7 +896,7 @@ void sampleSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, BasicParti
const Vec3 pos2 = pos + vel(i,j,k) * dt;
Real phiv2 = phi.getInterpolated(pos2);
- for (int i=0; i<number; ++i) {
+ for (int a=0; a<number; ++a) {
if (type == ParticleBase::PDROPLET) {
// Only generate drop particles at surface, slightly inside fluid
if ( phi(i,j,k) < -DROP_THRESH || phi(i,j,k) > 0. ) continue;
diff --git a/intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp b/intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
index e7ca3060092..b54467cf2a3 100644
--- a/intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
+++ b/intern/mantaflow/intern/manta_pp/tbb/plugin/flip.cpp
@@ -699,11 +699,9 @@ void adjustSndParts(BasicParticleSystem& parts, FlagGrid& flags, LevelsetGrid& p
//! update velocities. set new particle position. optional: convert between particle types, partLife update
-void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravity, BasicParticleSystem& parts, ParticleDataImpl<Vec3>& partVel, ParticleDataImpl<int>* partLife=NULL) {
+void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravity, BasicParticleSystem& parts, ParticleDataImpl<Vec3>& partVel, ParticleDataImpl<int>* partLife=NULL, Real bubbleRise=0.5) {
RandomStream mRand(9832);
- Real coefficient = 0.5;
Vec3 grav = gravity * flags.getParent()->getDt() / flags.getParent()->getDx();
- Vec3 buoyancy = (-1) * grav * coefficient;
const Real DROP_THRESH = 0.866;
// Insert buffered particles now. In sampleSndParts() we buffered them.
@@ -727,6 +725,7 @@ void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravi
partVel[idx] += grav;
}
else if (parts.isBubble(idx)) {
+ Vec3 buoyancy = (-1) * grav * bubbleRise;
Vec3 randomVel = vel.getInterpolated( parts[idx].pos ) * mRand.getFloat(0.25, 0.5);
partVel[idx] += buoyancy + randomVel;
}
@@ -752,6 +751,7 @@ void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravi
}
// Get phiv for current and next particle position
+ pos = parts.getPos(idx);
const Vec3 pos2 = pos + partVel[idx] * dt;
Real phiv = phi.getInterpolated(pos);
Real phiv2 = phi.getInterpolated(pos2);
@@ -764,7 +764,7 @@ void updateSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, Vec3 gravi
parts.setStatus(idx, ParticleBase::PNEW | ParticleBase::PFLOATER);
}
}
-} static PyObject* _W_21 (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, "updateSndParts" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; LevelsetGrid& phi = *_args.getPtr<LevelsetGrid >("phi",0,&_lock); FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",1,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",2,& [...]
+} static PyObject* _W_21 (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, "updateSndParts" , !noTiming ); PyObject *_retval = 0; { ArgLocker _lock; LevelsetGrid& phi = *_args.getPtr<LevelsetGrid >("phi",0,&_lock); FlagGrid& flags = *_args.getPtr<FlagGrid >("flags",1,&_lock); MACGrid& vel = *_args.getPtr<MACGrid >("vel",2,& [...]
//! sample new particles of given type. control amount of particles with constraint and number of samples per cell
@@ -784,7 +784,7 @@ void sampleSndParts(LevelsetGrid& phi, FlagGrid& flags, MACGrid& vel, BasicParti
const Vec3 pos2 = pos + vel(i,j,k) * dt;
Real phiv2 = phi.getInterpolated(pos2);
- for (int i=0; i<number; ++i) {
+ for (int a=0; a<number; ++a) {
if (type == ParticleBase::PDROPLET) {
// Only generate drop particles
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list