Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
svchb committed Apr 4, 2024
1 parent a5e3ab1 commit 4e2059d
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions test/schemes/fluid/surface_tension.jl
Original file line number Diff line number Diff line change
@@ -1,79 +1,88 @@

@testset verbose=true "surface tension" begin
@testset verbose=true "cohesion_force_akinci" begin

surface_tension = TrixiParticles.SurfaceTensionAkinci(surface_tension_coefficient=1.0)
support_radius = 1.0
m_b = 1.0
pos_diff = [1.0, 1.0]

test_distance = 0.1
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance) * test_distance
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance) * test_distance
@test isapprox(zero[1], 0.1443038770421044, atol=6e-15)
@test isapprox(zero[2], 0.1443038770421044, atol=6e-15)

# maximum repulsion force
test_distance = 0.01
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance) * test_distance
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance) * test_distance
@test isapprox(zero[1], 0.15913517632298307, atol=6e-15)
@test isapprox(zero[2], 0.15913517632298307, atol=6e-15)

# near 0
test_distance = 0.2725
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance) * test_distance
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance) * test_distance
@test isapprox(zero[1], 0.0004360543645195717, atol=6e-15)
@test isapprox(zero[2], 0.0004360543645195717, atol=6e-15)

# maximum attraction force
test_distance = 0.5
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance) * test_distance
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance) * test_distance
@test isapprox(zero[1], -0.15915494309189535, atol=6e-15)
@test isapprox(zero[2], -0.15915494309189535, atol=6e-15)


# should be 0
test_distance = 1.0
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance) * test_distance
zero = TrixiParticles.cohesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance) * test_distance
@test isapprox(zero[1], 0.0, atol=6e-15)
@test isapprox(zero[2], 0.0, atol=6e-15)

end

@testset verbose=true "adhesion_force_akinci" begin

surface_tension = TrixiParticles.SurfaceTensionAkinci(surface_tension_coefficient=1.0)
support_radius = 1.0
m_b = 1.0
pos_diff = [1.0, 1.0]

test_distance = 0.1
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance, 1.0) * test_distance
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance, 1.0) *
test_distance
@test isapprox(zero[1], 0.0, atol=6e-15)
@test isapprox(zero[2], 0.0, atol=6e-15)

test_distance = 0.5
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance, 1.0) * test_distance
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance, 1.0) *
test_distance
@test isapprox(zero[1], 0.0, atol=6e-15)
@test isapprox(zero[2], 0.0, atol=6e-15)

# near 0
test_distance = 0.51
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance, 1.0) * test_distance
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance, 1.0) *
test_distance
@test isapprox(zero[1], -0.002619160170741761, atol=6e-15)
@test isapprox(zero[2], -0.002619160170741761, atol=6e-15)

# maximum adhesion force
test_distance = 0.75
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance, 1.0) * test_distance
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance, 1.0) *
test_distance
@test isapprox(zero[1], -0.004949747468305833, atol=6e-15)
@test isapprox(zero[2], -0.004949747468305833, atol=6e-15)


# should be 0
test_distance = 1.0
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b, pos_diff, test_distance, 1.0) * test_distance
zero = TrixiParticles.adhesion_force_akinci(surface_tension, support_radius, m_b,
pos_diff, test_distance, 1.0) *
test_distance
@test isapprox(zero[1], 0.0, atol=6e-15)
@test isapprox(zero[2], 0.0, atol=6e-15)

end
end

0 comments on commit 4e2059d

Please sign in to comment.