FluidSource Custom Task

Jump to navigation Jump to search

This custom task injects particles into a simulation.


The FluidSource custom task injects particles at a specified rate from a defined inlet (currently in OSParticulas only). Its main use of for injecting liquid or liquid-like particles such as a Tait liquid. While it can be used with other materials, the injection process does not work well unless the injected material clears out of the inlet region in time for the next injected particles.

Task Scheduling

In scripted files, a FluidSource starts by defining the material to inject:

CustomTask FluidSource
Parameter material,(matID)
Parameter matname,(matname)

In XML files, this task is started using a <Schedule> element, which must be within the single <CustomTasks> block:

<Schedule name='FluidSource'>
   <Parameter name='material'>(matID)</Parameter>
   <Parameter name='matname'>(matname)</Parameter>

The the two parameters for defining the material are:

  • (matID) or (matname) - specifies material type by number or name. If both are provided, the (matname) takes precedence.

Setting Injection Rate

The rate of injection is determined by adding the following commands to scripted files:

Parameter FlowRate,(rate)
Parameter FlowFunction,(rateFxn)
Parameter flow_x,(xNorm)
Parameter flow_y,(yNorm)
Parameter flow_z,(zNorm)

or adding these command to the task definition in XML files:

   <Parameter name='FlowRate'>(rate)</Parameter>
   <Parameter name='FlowFunction'>(rateFxn)</Parameter>
   <Parameter name='flow_x'>(xNorm)</Parameter>
   <Parameter name='flow_y'>(yNorm)</Parameter>
   <Parameter name='flow_z'>(zNorm)</Parameter>


  • (rate) or (rateFxn) - specifies the inject rate in (length units)3 per time unit. The (rate) option specifies a fixed and constant rate while (rateFxn) can provide a variable rate as a user-defined function of time. If both are provided, the (rateFxn) takes precedence.
  • (xNorm),(yNorm),(zNorm) - provide three components to a normal vector in the direction of flow (the vector need not be normalized). In 2D, (xNorm) and (yNorm) can be in any direction. In 3D, the injection is currently limited being along the x, y, or z axis, which means only one component can be nonzero (all components default to zero, so just specify the one non-zero value; if none are specified, 3D injection will be in the z direction).

Defining the Injection Pipe

The injection pipe is a width in 2D or an area in 3D and specified in scripted files with the following commands:

Parameter source_x,(xSrc)
Parameter source_y,(ySrc)
Parameter source_z,(zSrc)
Parameter inlet_width,(width)
Parameter inlet_depth,(depth)

or adding these command to the task definition in XML files:

   <Parameter name='source_x'>(xSrc)</Parameter>
   <Parameter name='source_y'>(ySrc)</Parameter>
   <Parameter name='source_z'>(zSrc)</Parameter>
   <Parameter name='inlet_width'>(width)</Parameter>
   <Parameter name='inlet_depth'>(depth)</Parameter>


  • (xSrc),(ySrc),(zSrc) - specify a point at the center of the pipe (only x and y coordinates needed in 2D).
  • (width) and (depth) - specifies the cross-sectional area of the rectangular pipe. In 2D, only (wdith) is needed and the depth of the pipe is the thickness of the 2D simulation. In 3D, the rectangle axes are aligned with the non-normal axes (e.g., for flow in x direction, width and depth are in the y and z directions, etc.).

Injected Particle Size

By default, the injected particle size will be the same as the default particle size for the current simulation (as set using the PtsPerElement command). If desired, that size can be changed with the following addition to scripted files

Parameter particle_scale,(scaleSize)

or adding this command to the task definition in XML files:

   <Parameter name='particle_scale'>(scaleSize)</Parameter>


  • (scaleSize) - specifies relative particle size compared to the simulation's default particle per cell (default is 1).

Task Action

Each time step checks the injection location and current flow rate. If enough time has passed since the last row of particles was injected, a new row of particles is injected into the simulation.

In addition, this simulation will check for any particles in a region ahead of the pipe with the same cross-sectional area as the pipe and a length normal to the pipe of one grid cell. Any particle in that region will have their velocities set equal to the current flow rate. This action is effectively providing a velocity boundary condition to a small region ahead of the pipe. Once out of that region, the particles are within the simulation. If particles get blocked once leaving that region, the injection process might not work well.


  • This task places no restrictions on the material type that gets injected, but it was designed for use with liquid or liquid-like materials. It might also work for soft-elastic materials or even any material provided their motion once out on inlet region is not overly impeded by other particles.
  • The injection of particles requires that the simulation is seeded with sufficient particles of the right material type and size in the Material Point Reservoir. If the reservoir is empty (or becomes empty), the simulation will continue, but no particles will be injected.