Skip to content

Add shifting zone #827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

LasNikas
Copy link
Collaborator

@LasNikas LasNikas commented Jun 10, 2025

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.

shifted_buffer_zone.mp4
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

pulse_wave_propagation.mp4

@LasNikas LasNikas requested review from svchb and efaulhaber June 10, 2025 15:01
@LasNikas LasNikas self-assigned this Jun 10, 2025
@LasNikas LasNikas added the enhancement New feature or request label Jun 10, 2025
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 14.58333% with 82 lines in your changes missing coverage. Please review.

Project coverage is 69.91%. Comparing base (114a57b) to head (2c21cec).

Files with missing lines Patch % Lines
src/schemes/boundary/open_boundary/system.jl 8.00% 46 Missing ⚠️
...c/schemes/boundary/open_boundary/boundary_zones.jl 29.62% 19 Missing ⚠️
src/callbacks/particle_shifting.jl 0.00% 14 Missing ⚠️
src/callbacks/update.jl 0.00% 2 Missing ⚠️
src/schemes/boundary/open_boundary/mirroring.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #827      +/-   ##
==========================================
- Coverage   70.60%   69.91%   -0.69%     
==========================================
  Files         106      106              
  Lines        6769     6845      +76     
==========================================
+ Hits         4779     4786       +7     
- Misses       1990     2059      +69     
Flag Coverage Δ
unit 69.91% <14.58%> (-0.69%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant