|
107 | 107 |
|
108 | 108 | boundary_model = BoundaryModelDummyParticles(bnd.density, bnd.mass, |
109 | 109 | state_equation=state_equation, |
| 110 | + viscosity=viscosity, |
110 | 111 | AdamiPressureExtrapolation(), |
111 | 112 | smoothing_kernel, smoothing_length) |
112 | 113 |
|
|
552 | 553 | end |
553 | 554 | end |
554 | 555 | end |
| 556 | + |
| 557 | + @testset verbose=true "Include Wall Velocity" begin |
| 558 | + # Define vertical interpolation line |
| 559 | + start_svector = SVector(0.0, 0.0) |
| 560 | + end_svector = SVector(0.0, 1.0) |
| 561 | + points_coords_ = range(start_svector, end_svector, length=10) |
| 562 | + points_coords = collect(reinterpret(reshape, eltype(start_svector), |
| 563 | + points_coords_)) |
| 564 | + |
| 565 | + # Linear velocity field for fluid and boundary |
| 566 | + v_fluid = InitialCondition(; |
| 567 | + coordinates=fluid_system.initial_condition.coordinates, |
| 568 | + density=1000.0, particle_spacing, |
| 569 | + velocity=(pos) -> SVector(0.0, pos[2])).velocity |
| 570 | + v_boundary = InitialCondition(; coordinates=boundary_system.coordinates, |
| 571 | + density=1000.0, particle_spacing, |
| 572 | + velocity=(pos) -> SVector(0.0, pos[2])).velocity |
| 573 | + |
| 574 | + boundary_system.boundary_model.cache.wall_velocity .= v_boundary |
| 575 | + |
| 576 | + v_ode = vcat(v_fluid, fluid.density') |
| 577 | + u_ode = fluid_system.initial_condition.coordinates |
| 578 | + |
| 579 | + v_wall_velocity = interpolate_points(points_coords, semi_boundary, |
| 580 | + include_wall_velocity=true, |
| 581 | + fluid_system, v_ode, u_ode).velocity |
| 582 | + |
| 583 | + v_no_wall_velocity = interpolate_points(points_coords, semi_boundary, |
| 584 | + include_wall_velocity=false, |
| 585 | + fluid_system, v_ode, u_ode).velocity |
| 586 | + |
| 587 | + @test isapprox(v_wall_velocity[2, 1], 0.0; atol=eps()) |
| 588 | + @test isapprox(v_no_wall_velocity[2, 1], 0.1; atol=eps()) |
| 589 | + @test any(isapprox.(v_wall_velocity[:, 3:end], v_no_wall_velocity[:, 3:end], |
| 590 | + atol=eps())) |
| 591 | + end |
555 | 592 | end |
556 | 593 |
|
557 | 594 | @testset verbose=true "3D" begin |
|
621 | 658 |
|
622 | 659 | boundary_model = BoundaryModelDummyParticles(bnd.density, bnd.mass, |
623 | 660 | state_equation=state_equation, |
| 661 | + viscosity=viscosity, |
624 | 662 | AdamiPressureExtrapolation(), |
625 | 663 | smoothing_kernel, smoothing_length) |
626 | 664 |
|
|
883 | 921 | compare_interpolation_result(result, expected_res) |
884 | 922 | end |
885 | 923 | end |
| 924 | + |
| 925 | + @testset verbose=true "Include Wall Velocity" begin |
| 926 | + # Define vertical interpolation line |
| 927 | + start_svector = SVector(0.0, 0.0, 0.0) |
| 928 | + end_svector = SVector(0.0, 1.0, 0.0) |
| 929 | + points_coords_ = range(start_svector, end_svector, length=10) |
| 930 | + points_coords = collect(reinterpret(reshape, eltype(start_svector), |
| 931 | + points_coords_)) |
| 932 | + |
| 933 | + # Linear velocity field for fluid and boundary |
| 934 | + v_fluid = InitialCondition(; |
| 935 | + coordinates=fluid_system.initial_condition.coordinates, |
| 936 | + density=1000.0, particle_spacing, |
| 937 | + velocity=(pos) -> SVector(0.0, pos[2], 0.0)).velocity |
| 938 | + v_boundary = InitialCondition(; coordinates=boundary_system.coordinates, |
| 939 | + density=1000.0, particle_spacing, |
| 940 | + velocity=(pos) -> SVector(0.0, pos[2], 0.0)).velocity |
| 941 | + |
| 942 | + boundary_system.boundary_model.cache.wall_velocity .= v_boundary |
| 943 | + |
| 944 | + v_ode = vcat(v_fluid, fluid.density') |
| 945 | + u_ode = fluid_system.initial_condition.coordinates |
| 946 | + |
| 947 | + v_wall_velocity = interpolate_points(points_coords, semi_boundary, |
| 948 | + include_wall_velocity=true, |
| 949 | + fluid_system, v_ode, u_ode).velocity |
| 950 | + |
| 951 | + v_no_wall_velocity = interpolate_points(points_coords, semi_boundary, |
| 952 | + include_wall_velocity=false, |
| 953 | + fluid_system, v_ode, u_ode).velocity |
| 954 | + |
| 955 | + @test isapprox(v_wall_velocity[2, 1], 0.0; atol=eps()) |
| 956 | + @test isapprox(v_no_wall_velocity[2, 1], 0.1; atol=eps()) |
| 957 | + @test any(isapprox.(v_wall_velocity[:, 3:end], v_no_wall_velocity[:, 3:end], |
| 958 | + atol=eps())) |
| 959 | + end |
886 | 960 | end |
887 | 961 | end; |
0 commit comments