Skip to content

Commit

Permalink
fix show box
Browse files Browse the repository at this point in the history
  • Loading branch information
LasNikas committed Jul 16, 2024
1 parent b668e26 commit cb44385
Showing 1 changed file with 36 additions and 7 deletions.
43 changes: 36 additions & 7 deletions test/systems/open_boundary_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@

reference_velocity = 1.0
@test_throws ArgumentError(error_str) OpenBoundarySPHSystem(inflow; sound_speed=1.0,
boundary_model=BoundaryModelLastiwka(),
buffer_size=0,
fluid_system=FluidSystemMock2(),
reference_density=0,
reference_pressure=0,
reference_velocity)

error_str = "`reference_pressure` must be either a function mapping " *
Expand All @@ -26,8 +29,14 @@

reference_pressure = [1.0, 1.0]
@test_throws ArgumentError(error_str) OpenBoundarySPHSystem(inflow; sound_speed=1.0,
boundary_model=BoundaryModelLastiwka(),
buffer_size=0,
fluid_system=FluidSystemMock2(),
reference_density=0,
reference_velocity=[
1.0,
1.0,
],
reference_pressure)

error_str = "`reference_density` must be either a function mapping " *
Expand All @@ -36,14 +45,28 @@

reference_density = [1.0, 1.0]
@test_throws ArgumentError(error_str) OpenBoundarySPHSystem(inflow; sound_speed=1.0,
boundary_model=BoundaryModelLastiwka(),
buffer_size=0,
fluid_system=FluidSystemMock2(),
reference_density)
reference_density,
reference_velocity=[
1.0,
1.0,
],
reference_pressure=0)
end
@testset "`show`" begin
f1(pos, t) = SVector(0.0, 0.0)
f2(pos, t) = 0.0
f3(pos, t) = 0.0

inflow = InFlow(; plane=([0.0, 0.0], [0.0, 1.0]), particle_spacing=0.05,
flow_direction=(1.0, 0.0), density=1.0, open_boundary_layers=4)
system = OpenBoundarySPHSystem(inflow; sound_speed=1.0, buffer_size=0,
boundary_model=BoundaryModelLastiwka(),
reference_density=f1,
reference_pressure=f2,
reference_velocity=f3,
fluid_system=FluidSystemMock2())

show_compact = "OpenBoundarySPHSystem{2}(InFlow) with 80 particles"
Expand All @@ -55,18 +78,23 @@
│ #particles: ………………………………………………… 80 │
│ #buffer_particles: ……………………………… 0 │
│ fluid system: …………………………………………… FluidSystemMock2 │
│ boundary model: ……………………………………… BoundaryModelLastiwka │
│ boundary: ……………………………………………………… InFlow │
│ flow direction: ……………………………………… [1.0, 0.0] │
│ prescribed velocity: ………………………… constant_vector
│ prescribed pressure: ………………………… constant_scalar
│ prescribed density: …………………………… constant_scalar
│ prescribed velocity: ………………………… #f3
│ prescribed pressure: ………………………… #f2
│ prescribed density: …………………………… #f1
│ width: ……………………………………………………………… 0.2 │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘"""
@test repr("text/plain", system) == show_box

outflow = OutFlow(; plane=([0.0, 0.0], [0.0, 1.0]), particle_spacing=0.05,
flow_direction=(1.0, 0.0), density=1.0, open_boundary_layers=4)
system = OpenBoundarySPHSystem(outflow; sound_speed=1.0, buffer_size=0,
boundary_model=BoundaryModelLastiwka(),
reference_density=f1,
reference_pressure=f2,
reference_velocity=f3,
fluid_system=FluidSystemMock2())

show_compact = "OpenBoundarySPHSystem{2}(OutFlow) with 80 particles"
Expand All @@ -78,11 +106,12 @@
│ #particles: ………………………………………………… 80 │
│ #buffer_particles: ……………………………… 0 │
│ fluid system: …………………………………………… FluidSystemMock2 │
│ boundary model: ……………………………………… BoundaryModelLastiwka │
│ boundary: ……………………………………………………… OutFlow │
│ flow direction: ……………………………………… [1.0, 0.0] │
│ prescribed velocity: ………………………… constant_vector
│ prescribed pressure: ………………………… constant_scalar
│ prescribed density: …………………………… constant_scalar
│ prescribed velocity: ………………………… #f3
│ prescribed pressure: ………………………… #f2
│ prescribed density: …………………………… #f1
│ width: ……………………………………………………………… 0.2 │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘"""
@test repr("text/plain", system) == show_box
Expand Down

0 comments on commit cb44385

Please sign in to comment.