Divooka Reference

Liquid

23 nodes

On this page 23

Add Liquid Body

Function

The scene with a rigid body in the tank, made by the Box, Sphere, Capsule and the other body nodes. A moving body floats or sinks by its density (water is 1000 kg/m³), is carried and thrown by the liquid and pushes it in turn; bodies collide with each other, with the scene's solids and with the tank's floor, its walls and its lid, where it has them: what holds the liquid holds what floats in it. The liquid feels a sphere, a box and a capsule as they are and any other shape as the box round it, and it does not feel a body thinner than a cell.

Signature
AddLiquidBody -> Liquid Scene Description
    scene: Liquid Scene Description
    body: Body Description
LiquidSceneDescription AddLiquidBody(
    LiquidSceneDescription scene,
    BodyDescription body)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
bodyBody Description—The body. A static one stands where it is, as a solid does; a kinematic one is moved by a session's Move Solid.

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Add Liquid Box

Function

The scene with a box of liquid in it, at rest or moving.

Signature
AddLiquidBox -> Liquid Scene Description
    scene: Liquid Scene Description
    name: Text
    position: Vector3d
    size: Vector3d
    velocity: Vector3d
LiquidSceneDescription AddLiquidBox(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    Vector3d size,
    Vector3d velocity)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
nameText—The body's name.
positionVector3d—The box's centre (m).
sizeVector3d—The box's size (m) along X, Y and Z; what lies outside the tank or inside a solid is left out.
velocityVector3d—The velocity it starts with (m/s).

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Add Liquid Drain

Function

The scene with a drain: a box in which liquid disappears. Set into the floor it is a plughole, and the liquid round it flows in as into a hole; a tank with a tap and a drain finds the depth at which one takes what the other gives.

Signature
AddLiquidDrain -> Liquid Scene Description
    scene: Liquid Scene Description
    name: Text
    position: Vector3d
    size: Vector3d
LiquidSceneDescription AddLiquidDrain(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    Vector3d size)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
nameText—The drain's name.
positionVector3d—Its centre (m).
sizeVector3d—Its size (m) along X, Y and Z: two cells deep or more, so that liquid falling fast does not pass through it in a step.

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Add Liquid Sphere

Function

The scene with a ball of liquid in it, at rest or moving: a drop about to fall.

Signature
AddLiquidSphere -> Liquid Scene Description
    scene: Liquid Scene Description
    name: Text
    position: Vector3d
    radius: Number
    velocity: Vector3d
LiquidSceneDescription AddLiquidSphere(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    double radius,
    Vector3d velocity)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
nameText—The body's name.
positionVector3d—The ball's centre (m).
radiusNumber—The ball's radius (m).
velocityVector3d—The velocity it starts with (m/s).

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Add Liquid Tap

Function

The scene with a tap: a round nozzle that pours liquid in for as long as it is open, as a jet with the velocity given. A hose, a waterfall's lip, a tap over a basin. The tank is given room for what its taps pour in their time, or in twenty seconds when they never close; Liquid Refused says when a run asked for more.

Signature
AddLiquidTap -> Liquid Scene Description
    scene: Liquid Scene Description
    name: Text
    position: Vector3d
    radius: Number
    velocity: Vector3d
    Rate (l/s): Number
    start: Number
    end: Number
LiquidSceneDescription AddLiquidTap(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    double radius,
    Vector3d velocity,
    double rate = 0,
    double start = 0,
    double end = 0)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
nameText—The tap's name.
positionVector3d—The middle of its mouth (m), inside the tank.
radiusNumber—Its mouth's radius (m); a jet wants a few cells across it.
velocityVector3d—The velocity the liquid leaves with (m/s): (0, 0, -2) pours straight down.
Rate (l/s)Number0How much it pours, in litres a second. 0 is a full jet, its mouth's area times its speed: 31 l/s for a radius of 5 cm at 4 m/s.
startNumber0When it opens (s).
endNumber0When it closes (s); 0: never.

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Add Liquid Trigger

Function

The scene with a trigger for its bodies, made by the Triggers nodes: at a time, at every interval, or when a body touches something, rises or falls past a height or moves faster than a speed, it pushes a body, releases one that was held, spawns a copy of one or removes one. Crates dropped into a tank one after another, a gate let go when a float rises. Triggers are looked at after every step of the bodies, in the order they were added; what they did is in the events of Liquid Bodies. A real-time scene does not take Water In Region, Detonate, Set Wind or Unpin Cloth, and says so here.

Signature
AddLiquidTrigger -> Liquid Scene Description
    scene: Liquid Scene Description
    trigger: Trigger Description
LiquidSceneDescription AddLiquidTrigger(
    LiquidSceneDescription scene,
    TriggerDescription trigger)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
triggerTrigger Description—The trigger. A spawn that repeats has room for 32 bodies the liquid flows round; later ones still fall and collide.

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Add Solid Box

Function

The scene with a solid box standing in the tank.

Signature
AddSolidBox -> Liquid Scene Description
    scene: Liquid Scene Description
    name: Text
    position: Vector3d
    size: Vector3d
LiquidSceneDescription AddSolidBox(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    Vector3d size)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
nameText—The solid's name.
positionVector3d—Its centre (m).
sizeVector3d—Its size (m) along X, Y and Z.

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Add Solid Sphere

Function

The scene with a solid ball standing in the tank.

Signature
AddSolidSphere -> Liquid Scene Description
    scene: Liquid Scene Description
    name: Text
    position: Vector3d
    radius: Number
LiquidSceneDescription AddSolidSphere(
    LiquidSceneDescription scene,
    string name,
    Vector3d position,
    double radius)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
nameText—The solid's name.
positionVector3d—Its centre (m).
radiusNumber—Its radius (m).

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Export Liquid Meshes

Function

Runs the scene and writes the liquid's surface at every frame as a mesh file, closed where it meets the tank, in metres and Divooka's axes (+Z up). Nothing is kept in memory. Returns the files written.

Signature
ExportLiquidMeshes -> Text Array
    scene: Liquid Scene Description
    folder: Text
    duration: Number
    framesPerSecond: Number
    prefix: Text
    format: Text
    smoothing: Integer
string[] ExportLiquidMeshes(
    LiquidSceneDescription scene,
    string folder,
    double duration = 1,
    double framesPerSecond = 24,
    string prefix = "liquid",
    string format = "ply",
    int smoothing = 2)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
folderText—The folder; created if missing.
durationNumber1How long to run (s).
framesPerSecondNumber24Frames per second of simulated time.
prefixTextliquidFile name prefix: files are prefix.0001.ply and on.
formatTextplyThe file format: ply (binary, the smallest), obj or stl.
smoothingInteger2How often the surface is smoothed before it is meshed.

Returns

resultText Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Export Liquid Mesh Frame

Function

Writes one frame of a recorded run as a mesh file (.ply, .obj or .stl by the path's ending) and returns the path.

Signature
ExportLiquidMeshFrame -> Text
    result: Liquid Result
    frame: Integer
    path: Text
string ExportLiquidMeshFrame(
    LiquidResult result,
    int frame,
    string path)

Parameters

nametypedefaultdescription
resultLiquid Result—The run.
frameInteger—The recorded frame, from 0.
pathText—The file to write; its folder is created if missing.

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Liquid Bodies

Function

The motion of the scene's bodies and solids over a recorded run, as a result the Results nodes read (Body Position, Body Path, Bodies Mesh) and the 3D view plays. Its frames are the run's own: frame 3 here is the moment of Liquid Surface's frame 3.

Signature
LiquidBodies(result: Liquid Result) -> Simulation Result
SimulationResult LiquidBodies(LiquidResult result)

Parameters

nametypedefaultdescription
resultLiquid Result—The run of a scene that has bodies.

Returns

resultSimulation Result
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Liquid Frame Count

Function

How many frames a run recorded.

Signature
LiquidFrameCount(result: Liquid Result) -> Integer
int LiquidFrameCount(LiquidResult result)

Parameters

nametypedefaultdescription
resultLiquid Result—

Returns

resultInteger
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Liquid Frame Particle Count

Function

How many particles the liquid is at a recorded frame: with taps and drains it changes. A particle is an eighth of a cell of liquid.

Signature
LiquidFrameParticleCount -> Integer
    result: Liquid Result
    frame: Integer
int LiquidFrameParticleCount(LiquidResult result, int frame)

Parameters

nametypedefaultdescription
resultLiquid Result—The run.
frameInteger—The recorded frame, from 0.

Returns

resultInteger
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Liquid Frame Time

Function

The simulated time of a recorded frame (s).

Signature
LiquidFrameTime(result: Liquid Result, frame: Integer) -> Number
double LiquidFrameTime(LiquidResult result, int frame)

Parameters

nametypedefaultdescription
resultLiquid Result—
frameInteger—

Returns

resultNumber
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Liquid Particle Count

Function

How many particles the liquid is at the end of the run.

Signature
LiquidParticleCount(result: Liquid Result) -> Integer
int LiquidParticleCount(LiquidResult result)

Parameters

nametypedefaultdescription
resultLiquid Result—

Returns

resultInteger
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Liquid Picture

Function

Runs the scene for a time and takes a picture of it: the ground, the solids and the liquid with its whitewater, lit by the sun.

Signature
LiquidPicture -> Pixel Image
    scene: Liquid Scene Description
    time: Number
    eye: Vector3d
    target: Vector3d
    width: Integer
    height: Integer
    fieldOfView: Number
PixelImage LiquidPicture(
    LiquidSceneDescription scene,
    double time,
    Vector3d eye,
    Vector3d target,
    int width = 640,
    int height = 480,
    double fieldOfView = 40)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
timeNumber—How long to run before the picture (s).
eyeVector3d—Where the camera stands (m).
targetVector3d—What it looks at (m).
widthInteger640The picture's width in pixels.
heightInteger480The picture's height in pixels.
fieldOfViewNumber40The camera's vertical field of view in degrees.

Returns

resultPixel Image
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Liquid Refused

Function

How many particles the taps could not pour during the run because the tank had no room left for them; 0 when every tap gave all it was asked for. A tank is given room for what its taps pour in their time (twenty seconds for a tap that never closes): close the taps, drain the tank, or run for less.

Signature
LiquidRefused(result: Liquid Result) -> Large Integer
long LiquidRefused(LiquidResult result)

Parameters

nametypedefaultdescription
resultLiquid Result—

Returns

resultLarge Integer
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Liquid Surface

Function

The liquid's surface at a recorded frame as a mesh: closed where it meets the tank, its triangles facing outwards.

Signature
LiquidSurface -> Streamed Vertex Mesh Data
    result: Liquid Result
    frame: Integer
StreamedVertexMeshData LiquidSurface(
    LiquidResult result,
    int frame)

Parameters

nametypedefaultdescription
resultLiquid Result—The run.
frameInteger—The recorded frame, from 0.

Returns

resultStreamed Vertex Mesh Data
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Liquid Surface Volume

Function

The volume the liquid's surface encloses at a recorded frame (m³): how much liquid the mesh holds.

Signature
LiquidSurfaceVolume -> Number
    result: Liquid Result
    frame: Integer
double LiquidSurfaceVolume(LiquidResult result, int frame)

Parameters

nametypedefaultdescription
resultLiquid Result—The run.
frameInteger—The recorded frame, from 0.

Returns

resultNumber
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

New Tank

Function

An empty tank standing on the ground: its floor and its four walls hold the liquid, and nothing leaves through its top.

Signature
NewTank -> Liquid Scene Description
    size: Vector3d
    position: Vector3d
    cellSize: Number
    whitewater: Truth
LiquidSceneDescription NewTank(
    Vector3d size,
    Vector3d position,
    double cellSize = 0.025,
    bool whitewater = true)

Parameters

nametypedefaultdescription
sizeVector3d—The tank's size (m) along X, Y and Z (up). It is made of whole cells counted in eights, so each side is rounded up to the next multiple of eight cells: choose a size that is one, such as 1.6 m in cells of 0.025 m, when the walls have to stand exactly there.
positionVector3d—The middle of the tank's floor (m).
cellSizeNumber0.025The size of a cell (m): the smallest detail the liquid has. A cell of liquid is eight particles, and halving the size is eight times as many.
whitewaterTruthTrueMake spray, foam and bubbles where the liquid breaks; they show in pictures.

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Open Tank

Function

The scene with its tank opened: without its lid, or without one or more of its walls. Liquid that reaches an open side leaves and is gone. A tank has a lid unless it is opened here, so that what splashes up comes down again.

Signature
OpenTank -> Liquid Scene Description
    scene: Liquid Scene Description
    top: Truth
    Side at smallest X: Truth
    Side at largest X: Truth
    Side at smallest Y: Truth
    Side at largest Y: Truth
LiquidSceneDescription OpenTank(
    LiquidSceneDescription scene,
    bool top = true,
    bool minX = false,
    bool maxX = false,
    bool minY = false,
    bool maxY = false)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
topTruthTrueTake the lid off: liquid thrown over the top is gone.
Side at smallest XTruthFalseTake away the wall at the tank's smallest X.
Side at largest XTruthFalseTake away the wall at its largest X.
Side at smallest YTruthFalseTake away the wall at its smallest Y.
Side at largest YTruthFalseTake away the wall at its largest Y.

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Set Liquid Gravity

Function

The scene with another gravity (m/s²), pointing down along -Z; 0 is weightless.

Signature
SetLiquidGravity -> Liquid Scene Description
    scene: Liquid Scene Description
    gravity: Number
LiquidSceneDescription SetLiquidGravity(
    LiquidSceneDescription scene,
    double gravity = 9.81)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—
gravityNumber9.81

Returns

resultLiquid Scene Description
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation

Simulate Liquid

Function

Runs the scene for a time and records the liquid's surface at every frame as a mesh, for the Liquid Surface node to read. A mesh of a tank of a few million particles is some hundred thousand triangles, so record few frames of a large tank (Keep Every).

Signature
SimulateLiquid -> Liquid Result
    scene: Liquid Scene Description
    duration: Number
    framesPerSecond: Number
    keepEvery: Integer
    smoothing: Integer
LiquidResult SimulateLiquid(
    LiquidSceneDescription scene,
    double duration = 1,
    double framesPerSecond = 30,
    int keepEvery = 1,
    int smoothing = 2)

Parameters

nametypedefaultdescription
sceneLiquid Scene Description—The scene.
durationNumber1How long to run (s).
framesPerSecondNumber30Frames per second of simulated time.
keepEveryInteger1Record every frame (1), every second one (2) and so on; the last frame is always recorded.
smoothingInteger2How often the surface is smoothed before it is meshed: 0 keeps the particles' unevenness, 2 takes most of it out, more rounds off what is thin.

Returns

resultLiquid Result
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Liquid
Package
Physics Simulation