|
261 | 261 | @testset verbose=true "Mirroring Methods" begin |
262 | 262 | function mirror(pressure_function, mirror_method; |
263 | 263 | particle_spacing=0.05, domain_size=(2.0, 1.0)) |
| 264 | + # Initialize a fluid block with pressure according to `pressure_function` |
| 265 | + # and a adjacent inflow and outflow open boundaries to test the pressure extrapolation. |
264 | 266 | domain_fluid = RectangularShape(particle_spacing, |
265 | 267 | round.(Int, domain_size ./ particle_spacing), |
266 | 268 | (0.0, 0.0), density=1000.0, |
|
283 | 285 | boundary_model=BoundaryModelTafuni(), |
284 | 286 | buffer_size=0) |
285 | 287 |
|
| 288 | + # Temporary semidiscretization just to extrapolate the pressure into the outflow system |
286 | 289 | semi = Semidiscretization(fluid_system, open_boundary_out) |
287 | | - |
288 | 290 | TrixiParticles.initialize_neighborhood_searches!(semi) |
289 | 291 |
|
290 | 292 | v_open_boundary = zero(outflow.initial_condition.velocity) |
|
307 | 309 | boundary_model=BoundaryModelTafuni(), |
308 | 310 | buffer_size=0) |
309 | 311 |
|
| 312 | + # Temporary semidiscretization just to extrapolate the pressure into the outflow system |
310 | 313 | semi = Semidiscretization(fluid_system, open_boundary_in) |
311 | 314 | TrixiParticles.initialize_neighborhood_searches!(semi) |
312 | 315 |
|
|
324 | 327 | end |
325 | 328 |
|
326 | 329 | function interpolate_pressure(mirror_method, pressure_func; particle_spacing=0.05) |
| 330 | + # First call the function above to initialize fluid with pressure according to the function |
| 331 | + # and then extrapolate pressure to the inflow and outflow boundary systems. |
| 332 | + # Then, in this function, we apply an SPH interpolation on this extrapolated pressure field |
| 333 | + # to get a continuous representation of the extrapolated pressure field to validate. |
327 | 334 | fluid_system, open_boundary_in, open_boundary_out, |
328 | 335 | v_fluid = mirror(pressure_func, mirror_method) |
329 | 336 |
|
|
341 | 348 | smoothing_length = 1.2 * particle_spacing |
342 | 349 | smoothing_kernel = WendlandC2Kernel{2}() |
343 | 350 |
|
344 | | - # Use a fluid system to interpolate the pressure |
| 351 | + # Use a temporary fluid system just to interpolate the pressure |
345 | 352 | interpolation_system = WeaklyCompressibleSPHSystem(entire_domain, |
346 | 353 | ContinuityDensity(), |
347 | 354 | nothing, smoothing_kernel, |
|
0 commit comments