Add shifting zone
In this PR, I aimed to further improve the robustness of the open boundary implementation. To test this, I simulated a pulse wave propagation scenario with prescribed_pressure_in = 1000 and prescribed_pressure_out = 0 (see code below).
To provoke instability, I initially removed a row of buffer particles (shown in red). The fluid particles (blue) in both simulations are evolved using EDAC without any particle shifting (i.e., no ParticleShiftingCallback).
In the top animation, I introduced a shifting zone (black frame) specifically for the inflow boundary zone, where the PST is applied exclusively within this region. This shifting zone is independent of the global ParticleShiftingCallback and can be enabled or disabled for each boundary zone as needed.
https://github.com/user-attachments/assets/dadcc794-bcdc-4f9b-a3c2-3d7e2228b8ea
using TrixiParticles
trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "pipe_flow_2d.jl");
open_boundary_layers=14, sol=nothing)
patch = RectangularShape(particle_spacing, (1, pipe.n_particles_per_dimension[2]),
(-0.6, 0.0), density=fluid_density)
ic = setdiff(extrude_geometry(plane_in; particle_spacing, density=fluid_density,
direction=-flow_direction, n_extrude=open_boundary_layers),
patch)
# With shifting zone
inflow_shifted = BoundaryZone(; plane=([0.0, 0.0], [0.0, domain_size[2]]),
plane_normal=flow_direction, open_boundary_layers,
density=fluid_density, particle_spacing, initial_condition=ic,
shift_particles=true, boundary_type=InFlow(),
boundary_coordinates=pipe.boundary.coordinates)
trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "pipe_flow_2d.jl");
open_boundary_layers=14, domain_size=(2.0, 0.4), tspan=(0.0, 5.0),
prefix="shifted", open_boundary_model=BoundaryModelTafuni(),
inflow=inflow_shifted,
reference_velocity_in=nothing, reference_density_in=nothing,
reference_velocity_out=nothing, reference_density_out=nothing,
reference_pressure_in=1000, reference_pressure_out=0)
# Whithout shifting zone
inflow = BoundaryZone(; plane=([0.0, 0.0], [0.0, domain_size[2]]),
plane_normal=flow_direction, open_boundary_layers,
density=fluid_density, particle_spacing, initial_condition=ic,
boundary_type=InFlow())
trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "pipe_flow_2d.jl");
open_boundary_layers=14, domain_size=(2.0, 0.4), tspan=(0.0, 5.0),
prefix="", open_boundary_model=BoundaryModelTafuni(), inflow=inflow,
reference_velocity_in=nothing, reference_density_in=nothing,
reference_velocity_out=nothing, reference_density_out=nothing,
reference_pressure_in=1000, reference_pressure_out=0)
Same setup with higher resolution and with pressure_in = 5000 and pressure_out = 0 and without any artificial provocation of instability
https://github.com/user-attachments/assets/ff53b939-ff8f-49d9-b515-576b112ad28e
Codecov Report
Attention: Patch coverage is 15.95745% with 79 lines in your changes missing coverage. Please review.
Project coverage is 69.62%. Comparing base (
3cb59d4) to head (99b583f).
Additional details and impacted files
@@ Coverage Diff @@
## main #827 +/- ##
==========================================
- Coverage 70.25% 69.62% -0.64%
==========================================
Files 106 106
Lines 6906 6979 +73
==========================================
+ Hits 4852 4859 +7
- Misses 2054 2120 +66
| Flag | Coverage Δ | |
|---|---|---|
| unit | 69.62% <15.95%> (-0.64%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.