Skip to content
Snippets Groups Projects
Commit 8193b39f authored by Frederik Hennig's avatar Frederik Hennig
Browse files

extend test driver to run LBM tests separately

parent 0e879163
Branches
No related merge requests found
Pipeline #76574 failed with stages
in 7 minutes and 50 seconds
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()
......@@ -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);
}
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment