[Bf-blender-cvs] [00aeafc] fluid-mantaflow: updated boundary and open bound settings

Sebastián Barschkis noreply at git.blender.org
Thu Jan 28 12:37:41 CET 2016


Commit: 00aeafc110872a01240009a701a6c9dfa5167119
Author: Sebastián Barschkis
Date:   Fri Jan 22 15:20:14 2016 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rB00aeafc110872a01240009a701a6c9dfa5167119

updated boundary and open bound settings

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

M	intern/smoke/intern/MANTA.cpp
M	intern/smoke/intern/scenarios/smoke.h
M	source/blender/blenkernel/intern/smoke.c

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

diff --git a/intern/smoke/intern/MANTA.cpp b/intern/smoke/intern/MANTA.cpp
index a49065a..a0a60bf 100644
--- a/intern/smoke/intern/MANTA.cpp
+++ b/intern/smoke/intern/MANTA.cpp
@@ -494,7 +494,7 @@ std::string Manta_API::get_real_value( const std::string& varName, SmokeModifier
 			else if (smd->domain->border_collisions == SM_BORDER_CLOSED) ss << "";
 		}
 		if (smd->domain->manta_solver_res == 3) {
-			if(smd->domain->border_collisions == SM_BORDER_OPEN) ss << "xXyYzZ";
+			if (smd->domain->border_collisions == SM_BORDER_OPEN) ss << "xXyYzZ";
 			else if (smd->domain->border_collisions == SM_BORDER_VERTICAL) ss << "zZ";
 			else if (smd->domain->border_collisions == SM_BORDER_CLOSED) ss << "";
 		}
diff --git a/intern/smoke/intern/scenarios/smoke.h b/intern/smoke/intern/scenarios/smoke.h
index 24a6370..7926106 100644
--- a/intern/smoke/intern/scenarios/smoke.h
+++ b/intern/smoke/intern/scenarios/smoke.h
@@ -72,7 +72,8 @@ const string prep_domain_low = "\n\
 # prepare domain low\n\
 flags.initDomain()\n\
 flags.fillGrid()\n\
-setOpenBound(flags=flags, bWidth=1, openBound=boundConditions, type=FlagOutflow|FlagEmpty)\n";
+if doOpen:\n\
+  setOpenBound(flags=flags, bWidth=1, openBound=boundConditions, type=FlagOutflow|FlagEmpty)\n";
 
 //////////////////////////////////////////////////////////////////////
 // HIGH RESOLUTION SETUP
@@ -115,7 +116,9 @@ xl_noise.timeAnim = $NOISE_TIMEANIM$ * upres\n";
 const string prep_domain_high = "\n\
 # prepare domain high\n\
 xl_flags.initDomain()\n\
-xl_flags.fillGrid()\n";
+xl_flags.fillGrid()\n\
+if doOpen:\n\
+  setOpenBound(flags=xl_flags, bWidth=1, openBound=boundConditions, type=FlagOutflow|FlagEmpty)\n";
 
 const string wavelet_turbulence_noise = "\n\
 # wavelet turbulence noise field\n\
@@ -311,37 +314,37 @@ def step_low():\n\
     density.add(inflow_grid)\n\
   \n\
   if using_colors:\n\
-    print ('Advecting colors')\n\
-    advectSemiLagrange(flags=flags, vel=vel, grid=color_r, order=$ADVECT_ORDER$)\n\
-    advectSemiLagrange(flags=flags, vel=vel, grid=color_g, order=$ADVECT_ORDER$)\n\
-    advectSemiLagrange(flags=flags, vel=vel, grid=color_b, order=$ADVECT_ORDER$)\n\
+    print('Advecting colors')\n\
+    advectSemiLagrange(flags=flags, vel=vel, grid=color_r, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
+    advectSemiLagrange(flags=flags, vel=vel, grid=color_g, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
+    advectSemiLagrange(flags=flags, vel=vel, grid=color_b, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
   \n\
   if using_fire:\n\
-    print ('Advecting fire')\n\
-    advectSemiLagrange(flags=flags, vel=vel, grid=fuel, order=$ADVECT_ORDER$)\n\
-    advectSemiLagrange(flags=flags, vel=vel, grid=react, order=$ADVECT_ORDER$)\n\
+    print('Advecting fire')\n\
+    advectSemiLagrange(flags=flags, vel=vel, grid=fuel, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
+    advectSemiLagrange(flags=flags, vel=vel, grid=react, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
   \n\
   print('Advecting density')\n\
-  advectSemiLagrange(flags=flags, vel=vel, grid=density, order=$ADVECT_ORDER$)\n\
+  advectSemiLagrange(flags=flags, vel=vel, grid=density, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
   \n\
   print('Advecting velocity')\n\
   advectSemiLagrange(flags=flags, vel=vel, grid=vel, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
   \n\
   for i in range(uvs):\n\
     print('Advecting UV and updating UVWeight')\n\
-    advectSemiLagrange(flags=flags, vel=vel, grid=uv[i], order=$ADVECT_ORDER$)\n\
+    advectSemiLagrange(flags=flags, vel=vel, grid=uv[i], order=$ADVECT_ORDER$, openBounds=doOpen)\n\
     updateUvWeight(resetTime=16.5 , index=i, numUvs=uvs, uv=uv[i])\n\
   \n\
   print('Walls')\n\
   setWallBcs(flags=flags, vel=vel)\n\
   \n\
   if using_heat:\n\
-    print ('Adding heat buoyancy')\n\
+    print('Adding heat buoyancy')\n\
     gravity=vec3(0,0,-0.0981) if dim==3 else vec3(0,-0.0981,0)\n\
     addBuoyancy2(flags=flags, grid=density, vel=vel, gravity=gravity, coefficient=$ALPHA$)\n\
     addBuoyancy2(flags=flags, grid=heat, vel=vel, gravity=gravity, coefficient=$BETA$*10)\n\
   else:\n\
-    print ('Adding buoyancy')\n\
+    print('Adding buoyancy')\n\
     gravity=vec3(0,0,-0.01 * $ALPHA$) if dim==3 else vec3(0,-0.01* $ALPHA$,0)\n\
     addBuoyancy(density=density, vel=vel, gravity=gravity, flags=flags)\n\
   \n\
@@ -396,18 +399,18 @@ def step_high():\n\
   \n\
   for substep in range(upres):\n\
     if using_colors: \n\
-      print ('Advecting colors high')\n\
-      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_color_r, order=$ADVECT_ORDER$)\n\
-      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_color_g, order=$ADVECT_ORDER$)\n\
-      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_color_b, order=$ADVECT_ORDER$)\n\
+      # print ('Advecting colors high')\n\
+      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_color_r, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
+      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_color_g, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
+      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_color_b, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
     \n\
     if using_fire: \n\
-      print ('Advecting fire high')\n\
-      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_fuel, order=$ADVECT_ORDER$)\n\
-      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_react, order=$ADVECT_ORDER$)\n\
+      # print ('Advecting fire high')\n\
+      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_fuel, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
+      advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_react, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
     \n\
     print('Advecting density high')\n\
-    advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_density, order=$ADVECT_ORDER$)\n\
+    advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_density, order=$ADVECT_ORDER$, openBounds=doOpen)\n\
   \n\
   xl.step()\n\
   \n\
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 49d9d84..bcac98f 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1607,7 +1607,7 @@ static void sample_derivedmesh(
 
 static void emit_from_derivedmesh(Object *flow_ob, SmokeDomainSettings *sds, SmokeFlowSettings *sfs, EmissionMap *em, float dt)
 {
-	clock_t start = clock();
+//	clock_t start = clock();
 	if (sfs->dm) {
 		DerivedMesh *dm;
 		int defgrp_index = sfs->vgroup_density - 1;
@@ -1760,9 +1760,9 @@ static void emit_from_derivedmesh(Object *flow_ob, SmokeDomainSettings *sds, Smo
 		dm->release(dm);
 	}
 	
-	clock_t end = clock();
-	float seconds = (float)(end - start) / CLOCKS_PER_SEC;
-	printf("TIME FOR RECONSTRUCTING SDF: %f \n", seconds);
+//	clock_t end = clock();
+//	float seconds = (float)(end - start) / CLOCKS_PER_SEC;
+//	printf("TIME FOR RECONSTRUCTING SDF: %f \n", seconds);
 }
 
 /**********************************************************
@@ -2903,7 +2903,7 @@ static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object *
 		// create shadows before writing cache so they get stored
 		smoke_calc_transparency(sds, scene);
 
-		if (sds->wt&& !(smd->domain->flags & MOD_SMOKE_USE_MANTA))
+		if (sds->wt)
 		{
 			smoke_turbulence_step(sds->wt, sds->fluid);
 		}




More information about the Bf-blender-cvs mailing list