tadd tests of ocean-drag function - Granular.jl - Julia package for granular dy… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit bee49459645cf53bd8d1d8871bd8098178ecb368 | |
parent db2bf7ae4d13aeddc44c8200e475cd3eb1059f1e | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 1 May 2017 10:50:46 -0400 | |
add tests of ocean-drag function | |
Diffstat: | |
M test/grid.jl | 25 +++++++++++++++++++++++++ | |
1 file changed, 25 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/test/grid.jl b/test/grid.jl | |
t@@ -112,3 +112,28 @@ SeaIce.sortIceFloesInOceanGrid!(sim, verbose=verbose) | |
@test sim.ice_floes[3].ocean_grid_pos == [2, 1] | |
@test sim.ocean.ice_floe_list[1, 1] == [1, 2] | |
@test sim.ocean.ice_floe_list[2, 1] == [3] | |
+ | |
+info("Testing ocean drag") | |
+sim = SeaIce.createSimulation() | |
+sim.ocean = SeaIce.createRegularOceanGrid([4, 4, 2], [4., 4., 2.]) | |
+sim.ocean.u[:,:,1,1] = 5. | |
+SeaIce.addIceFloeCylindrical(sim, [2.5, 3.5], 1., 1., verbose=verbose) | |
+SeaIce.addIceFloeCylindrical(sim, [2.6, 2.5], 1., 1., verbose=verbose) | |
+SeaIce.sortIceFloesInOceanGrid!(sim, verbose=verbose) | |
+sim.time = ocean.time[1] | |
+SeaIce.addOceanDrag!(sim) | |
+@test sim.ice_floes[1].force[1] > 0. | |
+@test sim.ice_floes[1].force[2] ≈ 0. | |
+@test sim.ice_floes[2].force[1] > 0. | |
+@test sim.ice_floes[2].force[2] ≈ 0. | |
+sim.ocean.u[:,:,1,1] = -5. | |
+sim.ocean.v[:,:,1,1] = 5. | |
+SeaIce.addIceFloeCylindrical(sim, [2.5, 3.5], 1., 1., verbose=verbose) | |
+SeaIce.addIceFloeCylindrical(sim, [2.6, 2.5], 1., 1., verbose=verbose) | |
+SeaIce.sortIceFloesInOceanGrid!(sim, verbose=verbose) | |
+sim.time = ocean.time[1] | |
+SeaIce.addOceanDrag!(sim) | |
+@test sim.ice_floes[1].force[1] < 0. | |
+@test sim.ice_floes[1].force[2] > 0. | |
+@test sim.ice_floes[2].force[1] < 0. | |
+@test sim.ice_floes[2].force[2] > 0. |