Skip to content

ParticleSink

Parametrable particle generator

Vec2d

Templates:

  • Vec2d

Target: SofaSphFluid

namespace: sofa::component::misc

parents:

  • ProjectiveConstraintSet

Data

Name Description Default value
name object name unnamed
printLog if true, emits extra messages at runtime. 0
tags list of the subsets the object belongs to
bbox this object bounding box
componentState The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). Undefined
listening if true, handle the events, otherwise ignore the events 0
group ID of the group containing this constraint. This ID is used to specify which constraints are solved by which solver, by specifying in each solver which groups of constraints it should handle. 0
endTime The constraint stops acting after the given value. Use a negative value for infinite constraints -1
normal plane normal
d0 plane d coef at which particles acceleration is constrained to 0 0
d1 plane d coef at which particles are removed 0
fixed indices of fixed particles
Visualization
showPlane enable/disable drawing of plane 0
Name Description Destination type name
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used) BaseContext
slaves Sub-objects used internally by this object BaseObject
master nullptr for regular objects, or master object for which this object is one sub-objects BaseObject
mechanicalStates List of mechanical states to which this component is associated BaseMechanicalState
mstate MechanicalState used by this component MechanicalState<Vec2d>
topology link to the topology container BaseMeshTopology

Vec3d

Templates:

  • Vec3d

Target: SofaSphFluid

namespace: sofa::component::misc

parents:

  • ProjectiveConstraintSet

Data

Name Description Default value
name object name unnamed
printLog if true, emits extra messages at runtime. 0
tags list of the subsets the object belongs to
bbox this object bounding box
componentState The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). Undefined
listening if true, handle the events, otherwise ignore the events 0
group ID of the group containing this constraint. This ID is used to specify which constraints are solved by which solver, by specifying in each solver which groups of constraints it should handle. 0
endTime The constraint stops acting after the given value. Use a negative value for infinite constraints -1
normal plane normal
d0 plane d coef at which particles acceleration is constrained to 0 0
d1 plane d coef at which particles are removed 0
fixed indices of fixed particles
Visualization
showPlane enable/disable drawing of plane 0
Name Description Destination type name
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used) BaseContext
slaves Sub-objects used internally by this object BaseObject
master nullptr for regular objects, or master object for which this object is one sub-objects BaseObject
mechanicalStates List of mechanical states to which this component is associated BaseMechanicalState
mstate MechanicalState used by this component MechanicalState<Vec3d>
topology link to the topology container BaseMeshTopology

Examples

ParticleSink.scn

<?xml version="1.0" ?>
<Node dt="0.005" gravity="0 -10 0" bbox="-6 -6 -6  6 6 6">
    <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Forward"/> <!-- Needed to use components [EulerExplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="SofaSphFluid"/> <!-- Needed to use components [ParticleSink ParticleSource] -->
    <VisualStyle displayFlags="showBehaviorModels showForceFields hideWireframe" />
    <DefaultAnimationLoop/>
    <Node name="Fluid">
        <EulerExplicitSolver symplectic="1" />
        <MechanicalObject name="MModel" showObject="1"/>
        <ParticleSource name="Source" 
            center="-0.375 0 -0.75    
            0 0 -0.75    
            0.375 0 -0.75    
            -0.75  0 -0.375    
            -0.375 0 -0.375    
            0 0 -0.375    
            0.375 0 -0.375    
            0.75  0 -0.375    
            -0.75  0  0.0    
            -0.375 0  0.0    
            0 0  0    
            0.375 0  0.0    
            0.75  0  0.0    
            -0.75  0  0.375    
            -0.375 0  0.375    
            0.0   0  0.375    
            0.375 0  0.375    
            0.75  0  0.375    
            -0.375 0  0.75    
            0 0  0.75    
            0.375 0  0.75" 
            translation="0 3 0" radius="0.01 0.1 0.01" velocity="0 -20 0" delay="0.01875" start="-0.1" stop="2" />
        <ParticleSink normal="0 1 0" d0="-10" d1="-11" showPlane="true" printLog="false" />
        <UniformMass name="M1" vertexMass="1.0" />
    </Node>
</Node>
def createScene(root_node):

   node = root_node.addChild('node', dt="0.005", gravity="0 -10 0", bbox="-6 -6 -6  6 6 6")

   node.addObject('RequiredPlugin', name="Sofa.Component.Mass")
   node.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Forward")
   node.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   node.addObject('RequiredPlugin', name="Sofa.Component.Visual")
   node.addObject('RequiredPlugin', name="SofaSphFluid")
   node.addObject('VisualStyle', displayFlags="showBehaviorModels showForceFields hideWireframe")
   node.addObject('DefaultAnimationLoop', )

   fluid = node.addChild('Fluid')

   fluid.addObject('EulerExplicitSolver', symplectic="1")
   fluid.addObject('MechanicalObject', name="MModel", showObject="1")
   fluid.addObject('ParticleSource', name="Source", center="-0.375 0 -0.75                 0 0 -0.75                 0.375 0 -0.75                 -0.75  0 -0.375                 -0.375 0 -0.375                 0 0 -0.375                 0.375 0 -0.375                 0.75  0 -0.375                 -0.75  0  0.0                 -0.375 0  0.0                 0 0  0                 0.375 0  0.0                 0.75  0  0.0                 -0.75  0  0.375                 -0.375 0  0.375                 0.0   0  0.375                 0.375 0  0.375                 0.75  0  0.375                 -0.375 0  0.75                 0 0  0.75                 0.375 0  0.75", translation="0 3 0", radius="0.01 0.1 0.01", velocity="0 -20 0", delay="0.01875", start="-0.1", stop="2")
   fluid.addObject('ParticleSink', normal="0 1 0", d0="-10", d1="-11", showPlane="true", printLog="false")
   fluid.addObject('UniformMass', name="M1", vertexMass="1.0")