diff --git a/tests/BasicLbmScenarios/CMakeLists.txt b/tests/BasicLbmScenarios/CMakeLists.txt index 3c619ac101e63161041e91150bc2e459c89b1fc2..3ce94b7c1c58b8ab04910e528cc8e338b44149f1 100644 --- a/tests/BasicLbmScenarios/CMakeLists.txt +++ b/tests/BasicLbmScenarios/CMakeLists.txt @@ -1,10 +1,19 @@ + +set( TestIDs + FullyPeriodic + MirroredHalfChannel + FreeSlipPipe +) + add_executable( TestBasicLbmScenariosCPU TestBasicLbmScenarios.cpp ) walberla_generate_sources( TestBasicLbmScenariosCPU SCRIPTS LbmAlgorithms.py SCRIPT_ARGS --target=cpu ) target_link_libraries( TestBasicLbmScenariosCPU PRIVATE walberla::core walberla::blockforest walberla::field walberla::geometry walberla::experimental ) -add_test( NAME TestBasicLbmScenariosCPU COMMAND TestBasicLbmScenariosCPU ) - add_dependencies( SfgTests TestBasicLbmScenariosCPU ) +foreach( TestID ${TestIDs} ) + add_test( NAME "TestBasicLbmScenariosCPU - ${TestID}" COMMAND TestBasicLbmScenariosCPU ${TestID} ) +endforeach() + if( $CACHE{WALBERLA_BUILD_WITH_HIP} ) find_package(hip REQUIRED) @@ -14,7 +23,10 @@ if( $CACHE{WALBERLA_BUILD_WITH_HIP} ) add_executable( TestBasicLbmScenariosGPU TestBasicLbmScenarios.cpp ) walberla_generate_sources( TestBasicLbmScenariosGPU SCRIPTS LbmAlgorithms.py SCRIPT_ARGS --target=hip FILE_EXTENSIONS ${_codegen_suffixes} ) target_link_libraries( TestBasicLbmScenariosGPU PRIVATE walberla::core walberla::blockforest walberla::field walberla::gpu walberla::geometry walberla::experimental hip::host ) - add_test( NAME TestBasicLbmScenariosGPU COMMAND TestBasicLbmScenariosGPU ) add_dependencies( SfgTests TestBasicLbmScenariosGPU ) + + foreach( TestID ${TestIDs} ) + add_test( NAME "TestBasicLbmScenariosGPU - ${TestID}" COMMAND TestBasicLbmScenariosGPU ${TestID} ) + endforeach() endif() diff --git a/tests/BasicLbmScenarios/FullyPeriodic.cpp b/tests/BasicLbmScenarios/FullyPeriodic.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/BasicLbmScenarios/TestBasicLbmScenarios.cpp b/tests/BasicLbmScenarios/TestBasicLbmScenarios.cpp index 5636011b615efe60732545be16714551baca601a..fd017d632fbb3463cb31d75b8b5f62d561491e93 100644 --- a/tests/BasicLbmScenarios/TestBasicLbmScenarios.cpp +++ b/tests/BasicLbmScenarios/TestBasicLbmScenarios.cpp @@ -9,17 +9,21 @@ #include <array> +#include <iostream> + #include "SimDomain.hpp" namespace BasicLbmScenarios { using namespace walberla; +using TestFunction = std::function< void(mpi::Environment &) >; + /** * Fully periodic force-driven flow. * The velocity in each cell should be steadily increasing. */ -void fullyPeriodic(Environment& env) +void fullyPeriodic(mpi::Environment& env) { SimDomain dom{ SimDomainBuilder{ .blocks = { 1, 1, 1 }, .cellsPerBlock = { 32, 32, 32 }, .periodic = { true, true, true } } @@ -56,7 +60,7 @@ void fullyPeriodic(Environment& env) * Flow is governed by the Hagen-Poiseuille-law, * with the maximum at the bottom. */ -void mirroredHalfChannel(Environment& env) +void mirroredHalfChannel(mpi::Environment& env) { size_t zCells { 64 }; /** @@ -142,7 +146,7 @@ void mirroredHalfChannel(Environment& env) * The pipe flow is initialized with a constant velocity in x-direction. * As free-slip walls do not impose any friction, velocity should remain constant in time. */ -void freeSlipPipe(Environment& env) +void freeSlipPipe(mpi::Environment& env) { SimDomain dom{ SimDomainBuilder{ .blocks = { 1, 1, 1 }, .cellsPerBlock = { 4, 32, 32 }, .periodic = { true, false, false } } @@ -246,12 +250,30 @@ void freeSlipPipe(Environment& env) velOutput(); } + +std::vector< std::tuple< std::string, TestFunction > > TESTS { + {"FullyPeriodic", fullyPeriodic}, + {"MirroredHalfChannel", mirroredHalfChannel}, + {"FreeSlipPipe", freeSlipPipe}, +}; + } // namespace BasicLbmScenarios int main(int argc, char** argv) { - walberla::Environment env{ argc, argv }; - // BasicLbmScenarios::fullyPeriodic(env); - BasicLbmScenarios::mirroredHalfChannel(env); - // BasicLbmScenarios::freeSlipPipe(env); + walberla::mpi::Environment env{ argc, argv }; + + if( argc < 1 ){ + std::cerr << "No Test ID was specified." << std::endl; + return -1; + } + + std::string testId { argv[1] }; + + for( auto& entry : BasicLbmScenarios::TESTS ){ + if( std::get< std::string >(entry) == testId ){ + std::get< BasicLbmScenarios::TestFunction >(entry)(env); + } + } + }