tadd restart test - sphere - GPU-based 3D discrete element method algorithm wit… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 491f154d1ad6079590583fd010250772d4e2990e | |
parent d66cb85228bd2b4f08f00a0fa2dbb4a5038a81fb | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 18 Apr 2022 11:47:10 +0200 | |
add restart test | |
Diffstat: | |
M tests/CMakeLists.txt | 37 +++++++++++++++++------------… | |
A tests/restart_tests.py | 35 +++++++++++++++++++++++++++++… | |
2 files changed, 55 insertions(+), 17 deletions(-) | |
--- | |
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt | |
t@@ -1,52 +1,55 @@ | |
find_package(PythonInterp REQUIRED) | |
-add_test(io_tests ${PYTHON_EXECUTABLE} | |
+add_test(io_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/io_tests.py) | |
-add_test(wall_contact_model_tests ${PYTHON_EXECUTABLE} | |
+add_test(restart_tests ${PYTHON_EXECUTABLE} | |
+ ${CMAKE_CURRENT_BINARY_DIR}/restart_tests.py) | |
+ | |
+add_test(wall_contact_model_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/contactmodel_wall.py) | |
-add_test(contact_model_tests ${PYTHON_EXECUTABLE} | |
+add_test(contact_model_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/contactmodel.py) | |
-add_test(wall_contact_model_young_tests ${PYTHON_EXECUTABLE} | |
+add_test(wall_contact_model_young_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/contactmodel_wall_young.py) | |
-add_test(contact_model_young_tests ${PYTHON_EXECUTABLE} | |
+add_test(contact_model_young_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/contactmodel_young.py) | |
-add_test(io_tests_fluid ${PYTHON_EXECUTABLE} | |
+add_test(io_tests_fluid ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/io_tests_fluid.py) | |
-add_test(porosity_tests ${PYTHON_EXECUTABLE} | |
+add_test(porosity_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/porosity_tests.py) | |
-add_test(memory_tests ${PYTHON_EXECUTABLE} | |
+add_test(memory_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/memcheck_tests.py) | |
-add_test(bond_tests ${PYTHON_EXECUTABLE} | |
+add_test(bond_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/bond_tests.py) | |
-add_test(cfd_tests ${PYTHON_EXECUTABLE} | |
+add_test(cfd_tests ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/cfd_tests.py) | |
-add_test(cfd_tests_neumann ${PYTHON_EXECUTABLE} | |
+add_test(cfd_tests_neumann ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/cfd_tests_neumann.py) | |
-add_test(cfd_tests_neumann-c_v=0.1 ${PYTHON_EXECUTABLE} | |
+add_test(cfd_tests_neumann-c_v=0.1 ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/cfd_tests_neumann-c_v=0.1.py) | |
-add_test(fluid_particle_interaction ${PYTHON_EXECUTABLE} | |
+add_test(fluid_particle_interaction ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/fluid_particle_interaction.py) | |
-add_test(cfd_tests_darcy ${PYTHON_EXECUTABLE} | |
+add_test(cfd_tests_darcy ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/cfd_tests_darcy.py) | |
-add_test(cfd_tests_neumann_darcy ${PYTHON_EXECUTABLE} | |
+add_test(cfd_tests_neumann_darcy ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/cfd_tests_neumann_darcy.py) | |
-add_test(fluid_particle_interaction_darcy ${PYTHON_EXECUTABLE} | |
+add_test(fluid_particle_interaction_darcy ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/fluid_particle_interaction_darcy.py) | |
-add_test(cfd_tests_darcy_particles ${PYTHON_EXECUTABLE} | |
+add_test(cfd_tests_darcy_particles ${PYTHON_EXECUTABLE} | |
${CMAKE_CURRENT_BINARY_DIR}/cfd_tests_darcy_particles.py) | |
diff --git a/tests/restart_tests.py b/tests/restart_tests.py | |
t@@ -0,0 +1,35 @@ | |
+#!/usr/bin/env python | |
+from pytestutils import * | |
+import sphere | |
+ | |
+print("### Restart tests ###") | |
+ | |
+# Generate data in python | |
+orig = sphere.sim(np=10000, nw=1, sid="test-initgrid") | |
+orig.generateRadii(histogram=False) | |
+orig.defaultParams() | |
+orig.g[2] = 0.0 | |
+orig.initRandomGridPos(gridnum = [100, 100, 100]) | |
+orig.initTemporal(current=0.0, total=0.0) | |
+orig.time_total[0] = 1e-7 | |
+orig.time_file_dt[0] = 1e-8 | |
+orig.writebin(verbose = False) | |
+orig.run(dry=True) | |
+orig.run() | |
+ | |
+restart = sphere.sim() | |
+restart.readbin("../output/" + orig.sid + ".output{:0=5}.bin".format(orig.stat… | |
+restart.time_total[0] += 1e-7 | |
+restart.time_file_dt[0] = 1e-8 | |
+restart.run(dry=True) | |
+restart.run() | |
+restart.readlast() | |
+restart.time_current = orig.time_current | |
+restart.time_step_count = orig.time_step_count | |
+restart.time_total = orig.time_total | |
+ | |
+compare(orig, restart, "Restart test: ") | |
+ | |
+# Remove temporary files | |
+cleanup(orig) | |
+cleanup(restart) |