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:
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¶
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):
With verbosity: true, the operator prints the lattice densities of the ramp:
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.