Skip to content

set_dp_pressure_gradient

Description

Initializes, inside an axis-aligned box, the rest state with a pressure that varies linearly along one dimension (X, Y or Z), from \(\Delta p_0\) at bounds.bmin to \(\Delta p_1\) at bounds.bmax (Pa, relative to the reference state). With \(x\) the coordinate along the chosen dimension:

\[ t = \mathrm{clamp}\!\left(\frac{x - x_{min}}{x_{max} - x_{min}},\, 0,\, 1\right), \qquad \rho_{LBM}(x) = \rho_0 + t\,(\rho_1 - \rho_0), \qquad f_i = w_i\,\rho_{LBM}(x), \]

where \(\rho_{0,1} = 1 + 3\,\Delta p_{0,1}\,\Delta t^2 / (\rho_{ref}\,\Delta x^2)\), as for set_dp_pressure. The velocity is zero.

It is typically used to smooth a pressure discontinuity set with set_dp_pressure: instead of a jump between two nodes, the pressure varies over the width of the box, and the acoustic waves leaving the discontinuity keep a front of that width (see the example below).

YAML syntax

1
2
3
4
5
6
set_distributions:
  - set_dp_pressure_gradient:
     delta_p: [ 0.5e6, -0.5e6 ]                           # Pa, at bmin and at bmax
     bounds: [[ 0.009, 0.0, 0.0 ], [ 0.011, 0.02, 0.015 ]]
     dimension: "X"
     verbosity: true
Parameters' description
Slot Type Default Description
delta_p [double;2] required pressure differences (Pa) relative to the reference state, at bounds.bmin and at bounds.bmax
bounds AABB required box where the pressure is set; the ramp goes from bmin to bmax along dimension
dimension string required dimension of the ramp: "X", "Y" or "Z"
verbosity bool false prints the pressures and the corresponding lattice densities

Warning

delta_p must contain exactly two values, and dimension must be "X", "Y" or "Z": the operator aborts otherwise.

Usage example

Pressure step smoothed by a ramp

A water channel (20 mm long, bounce-back walls at both ends) at +0.5 MPa on the left and -0.5 MPa on the right, with a linear transition over 2 mm (20 nodes):

do_domain:
  - domain:
     bounds:    [ [0, 0, 0], [0.02, 0.002, 0.002] ]
     cell_dims: [ 200, 20, 20 ]
     periodic:  [ false, true, true ]
     bounce_back_planes: [ plan_yz_0, plan_yz_l ]

set_lbm_parameters:
  - lbm_parameters:
     nuth: 1.0e-6
     avg_rho: 1000.0
     celerity: 14800.0

collision: mrt

set_distributions:
  - set_dp_pressure:
     delta_p: 0.5e6
     bounds: [[ 0.0, 0.0, 0.0 ], [ 0.009, 0.002, 0.002 ]]
  - set_dp_pressure:
     delta_p: -0.5e6
     bounds: [[ 0.011, 0.0, 0.0 ], [ 0.02, 0.002, 0.002 ]]
  - set_dp_pressure_gradient:
     delta_p: [ 0.5e6, -0.5e6 ]
     bounds: [[ 0.009, 0.0, 0.0 ], [ 0.011, 0.002, 0.002 ]]
     dimension: "X"
     verbosity: true

global:
   simulation_end_iteration: 300
   simulation_paraview_freq: 50
   display_paraview_first_timestep: true
   output_directory: "Gradient_ramp"

With verbosity: true, the operator prints the lattice densities of the ramp:

SetDPPressureGradientLBM: delta_p from 5.000000e+05 Pa to -5.000000e+05 Pa along X, corresponding to rho_lbm from 1.000007e+00 to 9.999932e-01

The figure compares this deck with the same deck without the ramp (sharp step at x = 10 mm). The pressure P is averaged over each YZ plane. The initial discontinuity splits into two acoustic waves travelling at \(c_s = c/\sqrt{3}\); with the ramp, their fronts keep the 2 mm width of the ramp.

set_dp_pressure_gradient
Pressure profiles along X at steps 0, 50 and 150 (CPU run, hippoLBM v1.0.2)