Skip to content

Building blocks

Operators

An operator is a small C++ component that does one thing: create the domain, compute the macroscopic variables, apply a collision, impose a boundary condition, write a file... Each operator has typed slots: its inputs and outputs.

$ hippoLBM --help set_dp_pressure_gradient
Operator    : set_dp_pressure_gradient

Description :
    This operator initializes the pressure for a LBM simulation as a linear
    ramp of delta_p (difference relative to the fluid's reference state,
    rho_lbm = 1, i.e. avg_rho_) inside an axis-aligned bounding box. ...

Slots       :
  bounds
    flow IN
    type math::AABB
    desc Box where the pressure is set. The gradient goes from bmin to bmax along dimension.
  delta_p
    flow IN
    type vector<double>
    desc Pressure differences (Pa) relative to the fluid's reference state ...
  dimension
    flow IN
    type string
    desc Dimension of the gradient: "X", "Y" or "Z".
  domain
    flow IN
    type hippoLBM::LBMDomain<19>
  ...

Slots are connected by name: when domain outputs the domain slot and lbm_parameters outputs Params, every later operator with a domain or Params input reads these values. You never wire operators by hand.

Batches

A YAML list of operators is a batch: the operators run in order. A batch can be given a name and used as an operator itself:

1
2
3
4
5
6
7
8
9
set_pressures:            # a batch named set_pressures ...
  - set_dp_pressure:      # ... made of one operator
     delta_p: 1.0e6
     quadrics: sphere

set_distributions:        # the hook set_distributions ...
  - set_distribution:
     value: 1.0
  - set_pressures         # ... calls the batch set_pressures

Batches can also loop (loop: true with a condition slot) or run conditionally (condition: with a boolean slot). The LBM time loop compute_loop is such a batch.

Setting slot values

A slot value is given in YAML under the operator name:

1
2
3
4
- register_solid_ball:
   id: 0
   center: [0.1, 0.05, 0.1]
   radius: 0.013

Values not given keep the default of the operator (see the Exhaustive Operator List). Required slots must be set, or be produced by an earlier operator.

Units

hippoLBM decks are written in physical (SI) units: lengths in m, viscosities in m²/s, pressures in Pa. Some values can be given with an explicit unit, for example bounds: [[0 m, 0 m, 0 m], [0.1 m, 0.1 m, 0.1 m]] or delta_p: [50 kg/m/s^2, -50 kg/m/s^2]. lbm_parameters converts them to lattice units.