1+ # This is a simple advection example with open boundaries. The setup is similar to
2+ # `periodic_channel_2d.jl`, but uses open boundaries instead of periodic ones.
3+
14using TrixiParticles
25using OrdinaryDiffEq
36
47# ==========================================================================================
58# ==== Resolution
6- particle_spacing = 0.01
9+ particle_spacing = 0.02
710
811# Make sure that the kernel support of fluid particles at a boundary is always fully sampled
912boundary_layers = 4
1013
1114# Make sure that the kernel support of fluid particles at an open boundary is always
1215# fully sampled.
13- # Note: Due to the dynamics at the inlets and outlets of open boundaries,
14- # it is recommended to use `open_boundary_layers > boundary_layers`
15- open_boundary_layers = 6
16+ open_boundary_layers = 4
1617
1718# ==========================================================================================
1819# ==== Experiment Setup
1920tspan = (0.0 , 2.0 )
2021
2122# Boundary geometry and initial fluid particle positions
22- domain_size = (1.0 , 0.4 )
23+ domain_size = (1.0 , 0.5 )
2324
2425flow_direction = [1.0 , 0.0 ]
2526reynolds_number = 100
@@ -43,7 +44,7 @@ pipe.boundary.coordinates[1, :] .-= particle_spacing * open_boundary_layers
4344
4445NDIMS = ndims (pipe. fluid)
4546
46- n_buffer_particles = pipe. n_particles_per_dimension[2 ]^ (NDIMS - 1 )
47+ n_buffer_particles = 5 * pipe. n_particles_per_dimension[2 ]^ (NDIMS - 1 )
4748
4849# ==========================================================================================
4950# ==== Fluid
@@ -58,16 +59,13 @@ kinematic_viscosity = prescribed_velocity * domain_size[2] / reynolds_number
5859
5960viscosity = ViscosityAdami (nu= kinematic_viscosity)
6061
61- # Alternatively the WCSPH scheme can be used
62+ # Alternatively the EDAC scheme can be used
6263if wcsph
6364 state_equation = StateEquationCole (; sound_speed, reference_density= fluid_density,
64- exponent= 1 )
65-
66- density_diffusion = DensityDiffusionMolteniColagrossi (delta= 0.1 )
65+ exponent= 7 )
6766
6867 fluid_system = WeaklyCompressibleSPHSystem (pipe. fluid, fluid_density_calculator,
6968 state_equation, smoothing_kernel,
70- density_diffusion= density_diffusion,
7169 smoothing_length, viscosity= viscosity,
7270 buffer_size= n_buffer_particles)
7371else
@@ -140,7 +138,7 @@ callbacks = CallbackSet(info_callback, saving_callback, UpdateCallback(),
140138 particle_shifting, extra_callback)
141139
142140sol = solve (ode, RDPK3SpFSAL35 (),
143- abstol= 1e-5 , # Default abstol is 1e-6 (may need to be tuned to prevent boundary penetration)
144- reltol= 1e-3 , # Default reltol is 1e-3 (may need to be tuned to prevent boundary penetration)
141+ abstol= 1e-8 , # Default abstol is 1e-6 (may need to be tuned to prevent boundary penetration)
142+ reltol= 1e-4 , # Default reltol is 1e-3 (may need to be tuned to prevent boundary penetration)
145143 dtmax= 1e-2 , # Limit stepsize to prevent crashing
146144 save_everystep= false , callback= callbacks);
0 commit comments