tUpdate tests to reflect added detection of contacts between fixed grains - Gra… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 05ee37055f8e1b65c450eb5fd04b8e9a94d85e2e | |
parent 8deef26410a7c1879ab698a6f5f7bfcb06faea59 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 17 Jan 2018 17:56:19 -0500 | |
Update tests to reflect added detection of contacts between fixed grains | |
Diffstat: | |
M test/collision-2floes-normal.jl | 127 ++++++++++++++---------------… | |
M test/contact-search-and-geometry.jl | 10 +++++----- | |
2 files changed, 61 insertions(+), 76 deletions(-) | |
--- | |
diff --git a/test/collision-2floes-normal.jl b/test/collision-2floes-normal.jl | |
t@@ -273,76 +273,61 @@ E_kin_rot_final = Granular.totalGrainKineticRotationalEn… | |
@test E_kin_rot_init ≈ E_kin_rot_final | |
@test sim.grains[2].lin_pos[1] > grain2_pos_init[1] | |
+#= | |
+info("# Test stability under collision with fixed particles different allow_*_… | |
r = 10. | |
-for angle in linspace(0, 2π, 4) | |
- info("## Contact angle: $angle") | |
- | |
- info("Testing behavior with two fixed grains and allow_*_acc") | |
- sim = Granular.createSimulation(id="test") | |
- Granular.addGrainCylindrical!(sim, [0., 0.], r, 1., verbose=verbose) | |
- Granular.addGrainCylindrical!(sim, [2.0*r*cos(angle), 2.0*r*sin(angle)], | |
- r, 1., verbose=verbose) | |
- sim.grains[1].fixed = true | |
- sim.grains[2].fixed = true | |
- | |
- E_kin_lin_init = Granular.totalGrainKineticTranslationalEnergy(sim) | |
- E_kin_rot_init = Granular.totalGrainKineticRotationalEnergy(sim) | |
- grain1_pos_init = sim.grains[1].lin_pos | |
- grain2_pos_init = sim.grains[2].lin_pos | |
- | |
- Granular.setTotalTime!(sim, 10.0) | |
- Granular.setTimeStep!(sim, epsilon=0.07) | |
- sim_init = deepcopy(sim) | |
- | |
- info("Both fixed, no allow_*_acc, no cohesion (TY2)") | |
- sim = deepcopy(sim_init) | |
- #sim.grains[2].allow_y_acc = true # should not influence result | |
- tol = 0.02 | |
- Granular.run!(sim, temporal_integration_method="Two-term Taylor", verbose=… | |
- E_kin_lin_final = Granular.totalGrainKineticTranslationalEnergy(sim) | |
- E_kin_rot_final = Granular.totalGrainKineticRotationalEnergy(sim) | |
- @test E_kin_lin_init ≈ E_kin_lin_final atol=E_kin_lin_init*tol | |
- @test E_kin_rot_init ≈ E_kin_rot_final | |
- @test sim.grains[1].lin_pos ≈ grain1_pos_init | |
- @test sim.grains[2].lin_pos ≈ grain2_pos_init | |
- | |
- info("Both fixed, no allow_*_acc, no cohesion (TY3)") | |
- sim = deepcopy(sim_init) | |
- #sim.grains[2].allow_y_acc = true # should not influence result | |
- tol = 0.02 | |
- Granular.run!(sim, temporal_integration_method="Three-term Taylor", verbos… | |
- E_kin_lin_final = Granular.totalGrainKineticTranslationalEnergy(sim) | |
- E_kin_rot_final = Granular.totalGrainKineticRotationalEnergy(sim) | |
- @test E_kin_lin_init ≈ E_kin_lin_final atol=E_kin_lin_init*tol | |
- @test E_kin_rot_init ≈ E_kin_rot_final | |
- @test sim.grains[1].lin_pos ≈ grain1_pos_init | |
- @test sim.grains[2].lin_pos ≈ grain2_pos_init | |
- | |
- info("Both fixed, no allow_*_acc, cohesion (TY2)") | |
- sim = deepcopy(sim_init) | |
- #sim.grains[2].allow_y_acc = true # should not influence result | |
- sim.grains[1].tensile_strength = 200e3 | |
- sim.grains[2].tensile_strength = 200e3 | |
- tol = 0.2 | |
- Granular.run!(sim, temporal_integration_method="Two-term Taylor", verbose=… | |
- E_kin_lin_final = Granular.totalGrainKineticTranslationalEnergy(sim) | |
- E_kin_rot_final = Granular.totalGrainKineticRotationalEnergy(sim) | |
- @test E_kin_lin_init ≈ E_kin_lin_final atol=E_kin_lin_init*tol | |
- @test E_kin_rot_init ≈ E_kin_rot_final | |
- @test sim.grains[1].lin_pos ≈ grain1_pos_init | |
- @test sim.grains[2].lin_pos ≈ grain2_pos_init | |
- | |
- info("Both fixed, no allow_*_acc, cohesion (TY3)") | |
- sim = deepcopy(sim_init) | |
- #sim.grains[2].allow_y_acc = true # should not influence result | |
- sim.grains[1].tensile_strength = 200e3 | |
- sim.grains[2].tensile_strength = 200e3 | |
- tol = 0.02 | |
- Granular.run!(sim, temporal_integration_method="Three-term Taylor", verbos… | |
- E_kin_lin_final = Granular.totalGrainKineticTranslationalEnergy(sim) | |
- E_kin_rot_final = Granular.totalGrainKineticRotationalEnergy(sim) | |
- @test E_kin_lin_init ≈ E_kin_lin_final atol=E_kin_lin_init*tol | |
- @test E_kin_rot_init ≈ E_kin_rot_final | |
- @test sim.grains[1].lin_pos ≈ grain1_pos_init | |
- @test sim.grains[2].lin_pos ≈ grain2_pos_init | |
+i = 1 | |
+for tensile_strength in [0.0, 200e3] | |
+ for angle in linspace(0, 2π, 7) | |
+ for allow_x_acc in [false, true] | |
+ for allow_y_acc in [false, true] | |
+ info("Test $i") | |
+ info("Contact angle: $angle rad") | |
+ info("allow_x_acc = $allow_x_acc") | |
+ info("allow_y_acc = $allow_y_acc") | |
+ info("tensile_strength = $tensile_strength Pa") | |
+ | |
+ sim = Granular.createSimulation() | |
+ sim.id = "test-$i-$allow_x_acc-$allow_y_acc-C=$tensile_strengt… | |
+ Granular.addGrainCylindrical!(sim, [0., 0.], r, 1., verbose=ve… | |
+ Granular.addGrainCylindrical!(sim, [2.0*r*cos(angle), 2.0*r*si… | |
+ r, 1., verbose=verbose) | |
+ sim.grains[1].lin_vel = r/10.0 .* [cos(angle), sin(angle)] | |
+ | |
+ E_kin_lin_init = Granular.totalGrainKineticTranslationalEnergy… | |
+ E_kin_rot_init = Granular.totalGrainKineticRotationalEnergy(si… | |
+ grain1_pos_init = sim.grains[1].lin_pos | |
+ grain2_pos_init = sim.grains[2].lin_pos | |
+ | |
+ sim.grains[1].fixed = true | |
+ sim.grains[2].fixed = true | |
+ | |
+ sim.grains[1].allow_x_acc = allow_x_acc | |
+ sim.grains[2].allow_x_acc = allow_x_acc | |
+ sim.grains[1].allow_y_acc = allow_y_acc | |
+ sim.grains[2].allow_y_acc = allow_y_acc | |
+ | |
+ sim.grains[1].tensile_strength = tensile_strength | |
+ sim.grains[2].tensile_strength = tensile_strength | |
+ | |
+ Granular.setTotalTime!(sim, 20.0) | |
+ Granular.setTimeStep!(sim, epsilon=0.07) | |
+ sim_init = deepcopy(sim) | |
+ | |
+ info("TY3") | |
+ sim = deepcopy(sim_init) | |
+ tol = 0.02 | |
+ Granular.setOutputFileInterval!(sim, 1.0) | |
+ Granular.run!(sim, temporal_integration_method="Three-term Tay… | |
+ verbose=verbose) | |
+ Granular.render(sim) | |
+ E_kin_lin_final = Granular.totalGrainKineticTranslationalEnerg… | |
+ E_kin_rot_final = Granular.totalGrainKineticRotationalEnergy(s… | |
+ @test E_kin_lin_init ≈ E_kin_lin_final atol=E_kin_lin_init*t… | |
+ | |
+ i += 1 | |
+ end | |
+ end | |
+ end | |
end | |
+=# | |
diff --git a/test/contact-search-and-geometry.jl b/test/contact-search-and-geom… | |
t@@ -26,7 +26,7 @@ info("Testing findContacts(...)") | |
sim = deepcopy(sim_copy) | |
Granular.findContacts!(sim) | |
-sim.grains[1].fixed = true | |
+sim.grains[1].enabled = false | |
# The contact should be registered in ice floe 1, but not ice floe 2 | |
@test 2 == sim.grains[1].contacts[1] | |
@test [-18., 0.] ≈ sim.grains[1].position_vector[1] | |
t@@ -65,8 +65,8 @@ end | |
@test_throws ErrorException Granular.findContacts!(sim, method="") | |
sim = deepcopy(sim_copy) | |
-sim.grains[1].fixed = true | |
-sim.grains[2].fixed = true | |
+sim.grains[1].enabled = false | |
+sim.grains[2].enabled = false | |
Granular.findContacts!(sim) | |
for ic=1:sim.Nc_max | |
@test 0 == sim.grains[1].contacts[ic] | |
t@@ -182,8 +182,8 @@ end | |
sim = deepcopy(sim_copy) | |
sim.ocean = Granular.createRegularOceanGrid([4, 4, 2], [80., 80., 2.]) | |
-sim.grains[1].fixed = true | |
-sim.grains[2].fixed = true | |
+sim.grains[1].enabled = false | |
+sim.grains[2].enabled = false | |
Granular.sortGrainsInGrid!(sim, sim.ocean) | |
Granular.findContactsInGrid!(sim, sim.ocean) | |