Search This Blog

Sunday, May 29, 2011

Pyro Solver




My posibbly dodgy NetBox / Node description:
--------------------------------------------------------------------------------
Create Source Mask
involves GasBuild Relationship Masks
help:
"A microsolver that builds a mask for each voxel to show the presence or absence of relationships between objects. It builds a mask field that represents where the affecting objects 
intersect with the fluid."

Theres a switch which switches between 2 GBRM (Gas Build Relationship Mask) Nodes  - 1 with an index field set to source index, and the other without.

Index Field help:
"An optional index field which is set to the object id of which object was closest to the given voxel and within the bandwidth distance."

Both of these nodes use density as a reference field.

the switch has an expression as follows:
 (ch("../sourcevelmerge") != 0) || (ch("../sourcetemperaturemerge") != 0)

so the switch takes the second input (input id1) if sourcevelmerge is not 0 or
sourcetemperaturemerge is not 0.

looking at the top level of the pyro solver - we can see these parms
under advanced/solvers.
Vel merge gives us the options 
(0) None, 
(1) Weighted Average, 
(2) Net New Source

Source Temperature merge (sourcetemperaturemerge ) gives us 
the same menu options.

So an index field is added if either of these are not zero, ie the switch is activated.

What does the index field actually do ?

The Create Source Mask NetBox also has a noise node followed by a switch.
"Add Noise" is a Gas Field VOP (GFV).

help:
"...the Volume VOP runs CVEX over a set fields. The CVex Shader can be defined as a .vfl file, a SHOP or by building a CVEX VOPnet inside this node - the most straight forward approach."

We can dive inside of this VOPnet and we see...

if source > 0 then..
   if anysource != 0 then...
        multiply by aaflow noise and mix this in with Amount parm

the switch following this is driven by !ch(../dosourcenoise)
which is the toggle at the top level - sources/ noise/Add Noise (toggle)

so summing up this box basically allows noise to be mixed into the source
and allows it to be turned on or off.
--------------------------------------------------------------------------------
Apply sources
switch to apply velocities ch("../sourcevelmerge")
driven at the top level by Advanced / Sources / Apply Vel Merge

The options are
None (Null)
source_vel_wavg (GC -Gas Calculate)
source_vel_netnewsource (GC)

Apply temp looks similar - a DOPS switch - note the icon is like a GC node
to apply different temperature situations
(0) No temp change
(1) source temp weighted average
(2) source temp net new source
--------------------------------------------------------------------------------
Gas Calculate Node
from the help :
"A microsolver that performs general calculations on a pair of fields....
The Gas Calculate DOP performs many different operations on a pair of fields. It can be used to scale or blend two fields.Another use is to find the intersection or union of signed distance fields by using the Maximum or Minimum function."

2 more switches add the data for  mix in source density and fuel.

--------------------------------------------------------------------------------
Add Fuel Model
the fuel model node /asset is a Gas Combustion Node
we can jump in and we see several GCalc nodes
--------------------------------------------------------------------------------
Gas Comb help:
"A microsolver that applies a combustion model to the simulation."
 GComb is working with several fields
Temperature
Fuel
Soot
Divergence
Burn
--------------------------------------------------------------------------------
Enable Fuel Model
This is simply a switch to enable or disable Fuel, driven by
1 - ch("../docombustion") 
(top level toggle - simulation/combustion/Allow Combustion)
--------------------------------------------------------------------------------
Calculate Force Scale
Constant Scale - GCalc
Build Force Scale - Gas Field VOP
Blur Force Scale - Gas Blur
--------------------------------------------------------------------------------
Gas Blur - from the help
"A microsolver that blurs fields....using an optionally time dependent blur kernel."

What does it mean by time dependent blur kernel ?
--------------------------------------------------------------------------------
Velocity Update 
this netBox contains many nodes...
Buoyancy
Gas Buoyancy Node
from the help...
"...A microsolver that calculates an adhoc buoyancy force and updates a velocity field..."

"The Gas Buoyancy DOP calculates an approximate buoyancy force dependent on the temperature field and updates a velocity field according to that force."

"Given an ambient temperature Ta, temperature T, buoyancy lift l, and buoyancy direction of B, the force will be: ((l * (T-Ta)) * B "
--------------------------------------------------------------------------------
Viscosity Node
"A microsolver that diffuses a field or point attribute...
The Gas Diffuse DOP performs a diffusion operation on the field. This will smooth out sharp discontinuities and spread out the values of the field. On vector fields, such as a velocity field, this can simulate viscosity as each voxel’s velocity will be affected by its neighbor’s values."
--------------------------------------------------------------------------------
Vorticle Forces - the Gas Vorticle Force Node
"A microsolver that applies forces to a velocity field or geometry according to vorticle geometry. 
The Gas Vorticle Forces DOP applies paddlewheel like forces around each vorticle according to the vorticles attributes.
The purpose of vorticles is not to create new forces, but to maintain vorticles that naturally occur and prevent them from dissipating due to artificial viscosity.
The pscale attribute is used to determine the radius of influence of the vorticle. The up attribute is used to determine the orientation of the paddlewheel. The mag attribute is used to scale the force of the vorticle."
--------------------------------------------------------------------------------
Turbulence
has a bunch of nodes combing to form the turbulence Node (a switch)
No Turb - simply a null
switch 16 - driven by "align turb calc"
 - switches between compute turbulence alone (GFVop) and 4 nodes merged.

4 Merged Nodes:
Compute Turbulence
CreateForce Vel temp
Add Force Vel Temp to Vel
Clear Force Vel temp

Compute Turb - Gas Field VOP
We can dive into this and we see...


TimeStep is a volume VOP
looking at the globals for a Volume VOP will help us to understand this stuff.
P - position of the current Voxel
Densisty- the value of the density field art this voxel location
ix,iy,iz voxel indices - ranging from 0 to (res-1)
res[]x,y,z] - resolution of the current volume
Center - the center of the current Volume (not voxel)
Orig (in) - the bottom left corner of the current volume
Size - the size of the current volume

dPd[x,y,z] the derivative od P - these vectors store the change in P that5 occures in each step for x,y,z and voxel indices.

BB position iside the Bounding Box of the Volume - each coordinate ranges from 0-1.

Time the glo0bal time when the Vol is being evaluated
Time Inc - the timestep currently being used by the sim or playback
Frame - the current Frame being processed - NB this can be fractional.

So in this VOPnet
if amp or ramped amp of Force Scale is not very close to zero, use curl noise.
This result is multiplied by the timestep and the forceScale parm, then added to the incomuing velocity. Roughness for the curl noise can also be ramped.

i[x,y,z] as a vec is divided by res[x,y,z] as a vec to give BB (vec)

dPd[x,y,z] are individually multiplied by resX and -.5
and the lengths of these vectors are then output to a new vector which becomes the new SIZE.

They are also added together to give the origin.

This VolVop has DataBindings - they seem to link DOPS data with a Vex parameter.
here forcescale (DOPSdata )is being linked to forcescale(as a vex parameter)

and..

forceveltemp and vel DOPSdata is being 'linked to'  vel as a VEX parm
(if align turb calc is on)

--------------------------------------------------------------------------------
CreateForce Vel temp - Gas Match Field
from the help:
"A microsolver that rebuilds fields to match in size and resolution to a reference field.

The Gas Match Field DOP creates, resizes, and resamples as necessary to ensure the data matching the given name exists as a field of the same resolution and size as the reference field.

This DOP is very useful for creating adhoc fields that you need for intermediate results but don’t want to explicitly attach with the Scalar Field DOP. If you want to remove the adhoc field when done, you can zero it out. Constant fields are compressed so do not have the memory footprint of a varying field." 

The reference field is vel...
--------------------------------------------------------------------------------
Add force vel temp to vel node (Gas Calculate)
destination field:        vel
source field:               forcevel_temp
source property:        friction
calc :                           add

Clear force vel temp (Gas Calculate) 
destination field:        forcevel_temp
source field:               none
source property:        friction
calc :                           copy
--------------------------------------------------------------------------------
Speed Limit DOPS
doSpeedLimit is an enabling switch between :
noSpeedLimit ( a null DOP)
and minSpeed and maxSpeed - merged.
Min Speed and maxSpeed are both Gas Calculate Nodes.
--------------------------------------------------------------------------------
Build and Apply Sink
Build sink mask (Gas Build Relationship Mask) just like Source Build
merged with Remove Sink Density (Gas Calculate Node)
--------------------------------------------------------------------------------
Build Collisions
Build Collision Mask (Gas Build Collisions)
help:
"A microsolver that determines the collision field between the fluid field and any affector objects.
The Gas Build Collision Mask DOP builds a collision field that represents where affector objects overlap with the fluid field. It generates a signed distance field which is negative inside colliding objects and positive outside. It also generates a collision velocity field that stores the velocity of the affector object closest to each point."
this is merged with a apply collide temp switch which simply switches between not temp
and temp applied to colliders (Gas Calculate DOP)
--------------------------------------------------------------------------------
Create and Apply Pumps
just like sinks and Collisions above, we have a Gas Build Relationship Mask
that builds the Pump mask and Pump relationship using a index field and a reference field (density).

Also merged into pumps is a switch Solver which is controlled by the top level parm 
"pVelMerge".
help:
"The Switch Solver DOP allows simulation objects to be solved by one of several solvers connected as subdata to the Switch Solver. For each object, the solver to use is determined by the value of a Switch Value data attached to it. Unlike the Blend Solver or Multiple Solver, only one of the sub-solvers is applied to each object."

...and there is also a switch (not a switch solver) between no temperature and a pump temperature (set pupmp temp) Gas which is a Calculate Node.

These are merged together to form "Pumps" - a merge node.
--------------------------------------------------------------------------------
Velocity Advect
Gas Advect DOP
help:
"A microsolver that advects fields and geometry by a velocity field.
The Gas Advect DOP evolves fields and geometry according to a specified velocity field. The fields and geometry will be moved by the velocity field for a distance proportional to the current solver timestep."
--------------------------------------------------------------------------------
temp Project Velocity
--------------------------------------------------------------------------------
Field Advect
contains many nodes...
from L to R going into the merge node...

Rest Advect (Gas Advect DOP)
Diffuse Heat (Gas Blur DOP)
Cool Gas (Gas Calculate DOP)
Advect Vorticles (Gas Advect)
Stretch Vorticles (Gas Velocity Stretch)
Compress Fields (Gas Velocity Stretch)
with enable switch below it.
Diffuse Smoke and Diffuse Fuel nodes (both Gas Blur DOPS) merged

Heat Source - itself a null hook being fed by...
1. a null - no heat
2. from source - source to heat (Gas Calculate) merged with "Age our old heat" (also Gas Calculate)
3. from burn another merge - merging  Burn to heat (Gas Calculate again) Age_our_old_Heat

Fuel Advect 
(Field Advect (Gas Advect DOP) merged with Advect Fuel
(Gas Advect DOP) merged with itself again.)

Advection Stage (input 4 from Pyro's top level inputs (the 5th and final input))

Extrapolate into Collisions with a switch enabling / diabling.
(Gas Extrapolate DOP)
help:
"The Gas Extrapolate DOP extrapolates a field value along an SDF. The field’s value at an isosurface will be copied outwards along the increasing direction of the surface field."

Clamp inside Density (Gas Calculate)
merged with 
Clamp inside Fuel (Gas Calculate)

The final merge is "Field Update and Advect"
--------------------------------------------------------------------------------

The Pyro Object is brought in - and all solver data is deleted from it with a delete DOP named
"rebuild solver"
NB no objects are deleted - just data.

this is piped into the objects pipe of a multi-solver
MultiSolver help:

"The Multiple Solver DOP causes a simulation object to be solved by more than one Solver at each timestep. Each solver attached to this node is applied in order to the object.
Many solver combinations will produce strange or unexpected results. For example, applying two RBD Solvers will simply make objects move twice as fast.
The most useful solver combinations are ones where each solver acts on a different piece of data on the object. For example, the RBD Solver alters the Position data of an object. This may be followed by a SOP Solver that modifies the geometry of the object based on the position, velocity, or impact information generated by the RBD Solver.
It is important that you make sure the attached solvers have different names. Solvers by default all have the name “Solver” and will thus overwrite each other. The Unique Data Name toggle on the incoming solvers can be used to ensure that the names are different."

The data going into the data pipe of the multisolver (from left to right) is:
1. the gas substep node containing all the gas advection etc mentioned above.
2. 'Data to attach' - the 5th and final input from the pryo solver top level inputs
3. Clear fields (a merge DOP described below)
--------------------------------------------------------------------------------
Clear Fields
has a switch feeding into it, switching between 3 nodes.
1. null1
2. clear hidden (Gas Calculate Node)
3. clear Static (Gas Calculate Node)

this is merged with a another Gas Calculate Node 'Clear Additional'.

at the top level of the Pyro Node under  Advanced /Clear
we have a drop down menu giving us our three choices to clear no fields, hidden fields or Static fields...and we have a 'text field' to type the names of any additional  custom fields we may want to delete.
--------------------------------------------------------------------------------
After the Multisolver we have a Drag force with a switch enabling or disabling it.

..and a null.
--------------------------------------------------------------------------------
so in summary - its not as bad as it looks...







No comments: