PartBuilder¶
Builder for creating particle definitions with a fluent API.
PartBuilder
¶
Bases: Builder[Particle]
Builder for creating PART namelists.
Provides a fluent API for constructing Lagrangian particle classes including water droplets, aerosols, and other particle types.
| PARAMETER | DESCRIPTION |
|---|---|
part_id
|
Unique particle class identifier. Can also be set via with_id().
TYPE:
|
Examples:
>>> # Water droplet for sprinkler
>>> droplet = (PartBuilder("WATER_DROP")
... .as_water_droplet(diameter=0.001, temp=20.0)
... .with_breakup(True)
... .with_color("BLUE")
... .build())
>>> # Smoke aerosol
>>> smoke = (PartBuilder("SMOKE")
... .as_aerosol(diameter=0.00001, spec_id="SOOT")
... .with_color("GRAY")
... .build())
>>> # Custom particle
>>> particle = (PartBuilder("CUSTOM")
... .with_diameter(0.0005)
... .with_density(800.0)
... .with_lifetime(60.0)
... .build())
>>> # Using with_id() method
>>> particle = (PartBuilder()
... .with_id("TRACER")
... .as_tracer()
... .build())
Initialize the PartBuilder.
| PARAMETER | DESCRIPTION |
|---|---|
part_id
|
Unique particle class identifier
TYPE:
|
Source code in src/pyfds/builders/part.py
Functions¶
with_id
¶
Set the particle class identifier.
| PARAMETER | DESCRIPTION |
|---|---|
part_id
|
Unique particle class identifier
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
as_water_droplet
¶
Configure as water droplet.
Sets standard water droplet properties including density, boiling temperature, and heat of vaporization.
| PARAMETER | DESCRIPTION |
|---|---|
diameter
|
Droplet diameter (m)
TYPE:
|
temp
|
Initial temperature (°C), default: 20.0
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Examples:
Source code in src/pyfds/builders/part.py
as_aerosol
¶
Configure as aerosol particle.
| PARAMETER | DESCRIPTION |
|---|---|
diameter
|
Particle diameter (m)
TYPE:
|
spec_id
|
Gas species ID for aerosol
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Examples:
Source code in src/pyfds/builders/part.py
as_tracer
¶
Configure as massless tracer particle.
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Examples:
Source code in src/pyfds/builders/part.py
with_diameter
¶
Set particle diameter.
| PARAMETER | DESCRIPTION |
|---|---|
diameter
|
Particle diameter (m)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
with_density
¶
Set particle density.
| PARAMETER | DESCRIPTION |
|---|---|
density
|
Particle density (kg/m³)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
with_mass
¶
Set particle mass.
| PARAMETER | DESCRIPTION |
|---|---|
mass
|
Particle mass (kg)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
with_breakup
¶
Enable or disable droplet breakup.
| PARAMETER | DESCRIPTION |
|---|---|
enabled
|
Enable droplet breakup, default: True
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Examples:
Source code in src/pyfds/builders/part.py
with_breakup_parameters
¶
Set breakup CNS parameters.
| PARAMETER | DESCRIPTION |
|---|---|
cns_min
|
Minimum CNS for breakup
TYPE:
|
cns_max
|
Maximum CNS for breakup
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
with_color
¶
Set particle color for visualization.
| PARAMETER | DESCRIPTION |
|---|---|
color
|
Color name (e.g., "BLUE", "RED", "GREEN")
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Examples:
Source code in src/pyfds/builders/part.py
with_rgb
¶
Set particle RGB color.
| PARAMETER | DESCRIPTION |
|---|---|
r
|
Red value (0-255)
TYPE:
|
g
|
Green value (0-255)
TYPE:
|
b
|
Blue value (0-255)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Examples:
Source code in src/pyfds/builders/part.py
with_lifetime
¶
Set particle lifetime.
| PARAMETER | DESCRIPTION |
|---|---|
lifetime
|
Particle lifetime (s)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Examples:
Source code in src/pyfds/builders/part.py
with_initial_age
¶
Set initial particle age.
| PARAMETER | DESCRIPTION |
|---|---|
age
|
Initial age (s)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
with_drag_law
¶
Set drag law.
| PARAMETER | DESCRIPTION |
|---|---|
drag_law
|
Drag law: "SPHERE", "CYLINDER", or "SCREEN"
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
with_sampling_factor
¶
Set statistical sampling factor.
| PARAMETER | DESCRIPTION |
|---|---|
factor
|
Sampling factor (>= 1)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
as_static
¶
Configure as static particle (doesn't move).
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
with_orientation
¶
Set particle orientation vector.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
X component
TYPE:
|
y
|
Y component
TYPE:
|
z
|
Z component
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
with_surface
¶
Set surface ID for particle interaction.
| PARAMETER | DESCRIPTION |
|---|---|
surf_id
|
Surface ID
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
with_property
¶
Set property ID.
| PARAMETER | DESCRIPTION |
|---|---|
prop_id
|
Property ID
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PartBuilder
|
Self for method chaining |
Source code in src/pyfds/builders/part.py
Overview¶
PartBuilder creates particle definitions (&PART namelists) for sprinklers, droplets, tracers, and other particle-based phenomena.
Quick Examples¶
Water Droplets for Sprinklers¶
from pyfds.builders import PartBuilder
# Water droplet particles
water = (
PartBuilder("WATER")
.as_water_droplet()
.with_diameter(500) # microns
.build()
)
Tracer Particles¶
# Tracer particles for flow visualization
tracer = (
PartBuilder("TRACER")
.as_tracer()
.with_color("BLUE")
.build()
)
See Also¶
- Particles Guide - Particle modeling overview
- Suppression Systems - Sprinkler systems