Commit: 5749df3f8547f15b4500fc47604a68927218c96f Author: Sebastián Barschkis Date: Tue Nov 15 12:01:31 2016 +0200 Branches: fluid-mantaflow https://developer.blender.org/rB5749df3f8547f15b4500fc47604a68927218c96f
moved clean up and copy functions to pre/post step =================================================================== M intern/mantaflow/intern/strings/liquid_script.h M intern/mantaflow/intern/strings/smoke_script.h =================================================================== diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index 6b1d3d6..dc6f12d 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -164,6 +164,9 @@ def manta_step(start_frame):\n\ s.timeTotal = s.frame * dt0\n\ last_frame = s.frame\n\ \n\ + liquid_pre_step_low()\n\ + if using_highres:\n\ + liquid_pre_step_high()\n\ if start_frame == 1:\n\ phi.join(phiInit)\n\ phiObs.join(phiObsInit)\n\ @@ -190,8 +193,11 @@ def manta_step(start_frame):\n\ xl.timestep = s.timestep\n\ mantaMsg('High step / s.frame: ' + str(s.frame))\n\ liquid_step_high()\n\ - \n\ - s.step()\n"; + s.step()\n\ + \n\ + liquid_post_step_low()\n\ + if using_highres:\n\ + liquid_post_step_high()\n"; const std::string liquid_step_low = "\n\ def liquid_step():\n\ @@ -241,6 +247,11 @@ def liquid_step():\n\ extrapolateMACSimple(flags=flags, vel=vel, distance=4, intoObs=True)\n\ setWallBcs(flags=flags, vel=vel, fractions=fractions, phiObs=phiObs)\n\ \n\ + # TODO (sebbas): Clearing should not be needed once obvel are added correctly\n\ + clearInObstacle(flags=flags, grid=phi)\n\ + clearInObstacle(flags=flags, grid=phiParts)\n\ + pushOutofObs(parts=pp, flags=flags, phiObs=phiObs)\n\ + \n\ if (dim==3):\n\ # mis-use phiParts as temp grid to close the mesh\n\ phiParts.copyFrom(phi)\n\ @@ -250,10 +261,7 @@ def liquid_step():\n\ # set source grids for resampling, used in adjustNumber!\n\ pVel.setSource(vel, isMAC=True)\n\ adjustNumber(parts=pp, vel=vel, flags=flags, minParticles=1*minParticles, maxParticles=2*minParticles, phi=phi, exclude=phiObs, radiusFactor=radiusFactor, narrowBand=narrowBandWidth)\n\ - flipVelocityUpdate(vel=vel, velOld=velOld, flags=flags, parts=pp, partVel=pVel, flipRatio=0.97)\n\ - \n\ - copyVec3ToReal(source=vel, targetX=x_vel, targetY=y_vel, targetZ=z_vel)\n\ - copyVec3ToReal(source=obvel, targetX=x_obvel, targetY=y_obvel, targetZ=z_obvel)\n"; + flipVelocityUpdate(vel=vel, velOld=velOld, flags=flags, parts=pp, partVel=pVel, flipRatio=0.97)\n"; const std::string liquid_step_high = "\n\ def liquid_step_high():\n\ @@ -261,8 +269,8 @@ def liquid_step_high():\n\ xl_pp.readParticles(pp)\n\ \n\ # create surface\n\ - gridParticleIndex( parts=xl_pp , flags=xl_flags, indexSys=xl_pindex, index=xl_gpi )\n\ - averagedParticleLevelset( xl_pp, xl_pindex, xl_flags, xl_gpi, xl_phiParts, radiusFactor , 1, 1 )\n\ + gridParticleIndex(parts=xl_pp, flags=xl_flags, indexSys=xl_pindex, index=xl_gpi )\n\ + averagedParticleLevelset(xl_pp, xl_pindex, xl_flags, xl_gpi, xl_phiParts, radiusFactor , 1, 1)\n\ xl_phi.join(xl_phiParts)\n\ \n\ xl_phi.createMesh(xl_mesh)\n"; diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h index 066be54..ba5d87d 100644 --- a/intern/mantaflow/intern/strings/smoke_script.h +++ b/intern/mantaflow/intern/strings/smoke_script.h @@ -244,6 +244,11 @@ def manta_step(start_frame):\n\ s.frame = start_frame\n\ s.timeTotal = s.frame * dt0\n\ last_frame = s.frame\n\ + \n\ + smoke_pre_step_low()\n\ + if using_highres:\n\ + smoke_pre_step_high()\n\ + \n\ while s.frame == last_frame:\n\ mantaMsg('Adapt timestep')\n\ maxvel = vel.getMaxValue()\n\ @@ -264,16 +269,15 @@ def manta_step(start_frame):\n\ step_high()\n\ if using_fire:\n\ update_flame_high()\n\ - s.step()\n"; + s.step()\n\ + \n\ + smoke_post_step_low()\n\ + if using_highres:\n\ + smoke_post_step_high()\n"; const std::string smoke_step_low = "\n\ def step_low():\n\ mantaMsg('Smoke step low')\n\ - copyRealToVec3(sourceX=x_vel, sourceY=y_vel, sourceZ=z_vel, target=vel)\n\ - copyRealToVec3(sourceX=x_obvel, sourceY=y_obvel, sourceZ=z_obvel, target=obvel)\n\ - if dim == 2:\n\ - density.add(inflow_grid)\n\ - \n\ mantaMsg('Advecting density')\n\ advectSemiLagrange(flags=flags, vel=vel, grid=density, order=$ADVECT_ORDER$)\n\ \n\ @@ -309,7 +313,6 @@ def step_low():\n\ mantaMsg('Adding buoyancy')\n\ addBuoyancy(density=density, vel=vel, gravity=gravity, flags=flags)\n\ \n\ - copyRealToVec3(sourceX=x_force, sourceY=y_force, sourceZ=z_force, target=forces)\n\ mantaMsg('Adding forces')\n\ addForceField(flags=flags, vel=vel, force=forces)\n\ forces.clear()\n\ @@ -319,9 +322,6 @@ def step_low():\n\ \n\ mantaMsg('Pressure')\n\ solvePressure(flags=flags, vel=vel, pressure=pressure)\n\ - \n\ - copyVec3ToReal(source=vel, targetX=x_vel, targetY=y_vel, targetZ=z_vel)\n\ - copyVec3ToReal(source=obvel, targetX=x_obvel, targetY=y_obvel, targetZ=z_obvel)\n\ \n\ def process_burn_low():\n\ mantaMsg('Process burn low')\n\ @@ -337,9 +337,6 @@ def update_flame_low():\n\ const std::string smoke_step_high = "\n\ def step_high():\n\ mantaMsg('Smoke step high')\n\ - copyRealToVec3(sourceX=texture_u, sourceY=texture_v, sourceZ=texture_w, target=uv[0])\n\ - copyRealToVec3(sourceX=texture_u2, sourceY=texture_v2, sourceZ=texture_w2, target=uv[1])\n\ - \n\ interpolateMACGrid(source=vel, target=xl_vel)\n\ for i in range(uvs):\n\ mantaMsg('Advecting UV')\n\ @@ -380,9 +377,6 @@ def step_high():\n\ \n\ mantaMsg('Advecting density high')\n\ advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_density, order=$ADVECT_ORDER$, openBounds=doOpen)\n\ - \n\ - copyVec3ToReal(source=uv[0], targetX=texture_u, targetY=texture_v, targetZ=texture_w)\n\ - copyVec3ToReal(source=uv[1], targetX=texture_u2, targetY=texture_v2, targetZ=texture_w2)\n\ \n\ def process_burn_high():\n\ mantaMsg('Process burn high')\n\ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs