Commit 6d263797 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Merge branch 'master' of i10git.cs.fau.de:walberla/walberla

parents 79d35512 31ad4832
Pipeline #40355 passed with stages
in 184 minutes and 24 seconds
......@@ -72,5 +72,4 @@ cmake_install.cmake
CMakeDefs.h
/moduleStatistics.json
/walberla-config.cmake
/cmake-build-debug/
/cmake-build-release/
cmake-build-*
This diff is collapsed.
......@@ -25,7 +25,7 @@
##
############################################################################################################################
CMAKE_MINIMUM_REQUIRED (VERSION 3.10)
CMAKE_MINIMUM_REQUIRED (VERSION 3.14)
PROJECT ( walberla )
......@@ -250,6 +250,14 @@ else()
endif()
mark_as_advanced ( WALBERLA_CXX_COMPILER_IS_MPI_WRAPPER )
# Check for intel llvm compiler
if( CMAKE_CXX_COMPILER MATCHES "icpx" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "icpx" )
option ( WALBERLA_CXX_COMPILER_IS_INTELLLVM "Use Intel LLVM compiler" ON )
else()
option ( WALBERLA_CXX_COMPILER_IS_INTELLLVM "Use Intel LLVM compiler" OFF )
endif()
mark_as_advanced ( WALBERLA_CXX_COMPILER_IS_INTELLLVM )
############################################################################################################################
......@@ -357,13 +365,13 @@ endif()
# architecture optimization
if( WALBERLA_OPTIMIZE_FOR_LOCALHOST )
if( WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_INTEL OR WALBERLA_CXX_COMPILER_IS_CLANG )
if( CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64" )
if(( CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" ) AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64" )
# no -march=native available on this compiler, but there is currently only one such processor
else()
add_flag ( CMAKE_CXX_FLAGS "-march=native" )
add_flag ( CMAKE_C_FLAGS "-march=native" )
endif()
if( WALBERLA_CXX_COMPILER_IS_INTEL )
add_flag ( CMAKE_CXX_FLAGS "-xhost" )
add_flag ( CMAKE_C_FLAGS "-xhost" )
......@@ -427,6 +435,10 @@ if ( WALBERLA_BUILD_WITH_FASTMATH )
if( WALBERLA_CXX_COMPILER_IS_MSVC )
add_flag( CMAKE_CXX_FLAGS "/fp:fast" )
endif()
else()
if( WALBERLA_CXX_COMPILER_IS_INTELLLVM )
add_flag( CMAKE_CXX_FLAGS "-fp-model=precise")
endif()
endif()
# Xcode generator disables -isystem flag, even though current versions of Xcode support it
......@@ -475,7 +487,7 @@ endif()
############################################################################################################################
try_compile( WALBERLA_USE_STD_FILESYSTEM "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_FILESYSTEM COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/TestStdFilesystem" )
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_FILESYSTEM COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/TestStdFilesystem" OUTPUT_VARIABLE TRY_COMPILE_OUTPUT)
if( WALBERLA_USE_STD_FILESYSTEM )
# detect https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90050 by checking whether it segfaults
execute_process( COMMAND "${CMAKE_CURRENT_BINARY_DIR}/TestStdFilesystem" OUTPUT_QUIET RESULT_VARIABLE WALBERLA_STD_FILESYSTEM_WORKS )
......@@ -484,14 +496,14 @@ if( WALBERLA_USE_STD_FILESYSTEM AND WALBERLA_STD_FILESYSTEM_WORKS EQUAL 0 )
message( STATUS "Found std::filesystem")
else()
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM OUTPUT_VARIABLE TRY_COMPILE_OUTPUT)
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem")
endif()
if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
unset( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM CACHE )
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM LINK_LIBRARIES stdc++fs )
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM LINK_LIBRARIES stdc++fs OUTPUT_VARIABLE TRY_COMPILE_OUTPUT)
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem in libstdc++fs")
list ( APPEND SERVICE_LIBS -lstdc++fs )
......@@ -500,14 +512,15 @@ else()
if( NOT WALBERLA_CXX_COMPILER_IS_MSVC AND NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
unset( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM CACHE )
try_compile( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestStdFilesystem.cpp"
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM LINK_LIBRARIES c++experimental )
COMPILE_DEFINITIONS -DWALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM LINK_LIBRARIES c++experimental OUTPUT_VARIABLE TRY_COMPILE_OUTPUT)
if( WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
message( STATUS "Found std::experimental::filesystem in libc++experimental")
list ( APPEND SERVICE_LIBS -lc++experimental )
endif()
endif()
if( NOT WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM AND NOT WALBERLA_USE_STD_FILESYSTEM)
message(FATAL_ERROR "Neither std::filesystem nor std::experimental::filesystem are available")
message( WARNING ${TRY_COMPILE_OUTPUT} )
message( FATAL_ERROR "Neither std::filesystem nor std::experimental::filesystem are available" )
endif()
endif()
......@@ -557,8 +570,20 @@ if ( WALBERLA_CXX_COMPILER_IS_MSVC )
endif ( )
############################################################################################################################
############################################################################################################################
##
## Python
##
#############################################################################################################################
if ( WALBERLA_BUILD_WITH_CODEGEN OR WALBERLA_BUILD_WITH_PYTHON )
if ( DEFINED PYTHON_ROOT_DIR OR DEFINED PYTHON_EXECUTABLE )
message( WARNING "Setting PYTHON_ROOT_DIR or PYTHON_EXECUTABLE will likely not work. Use Python_ROOT_DIR instead." )
endif ()
cmake_policy( SET CMP0094 NEW )
set( Python_FIND_FRAMEWORK LAST )
find_package( Python COMPONENTS Interpreter Development )
endif ()
############################################################################################################################
##
......@@ -566,18 +591,17 @@ endif ( )
##
#############################################################################################################################
if ( WALBERLA_BUILD_WITH_CODEGEN )
find_package( PythonInterp 3 QUIET REQUIRED)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import lbmpy"
execute_process(COMMAND ${Python_EXECUTABLE} -c "import lbmpy"
RESULT_VARIABLE LBMPY_FOUND )
if(NOT LBMPY_FOUND EQUAL 0)
message(FATAL_ERROR "WALBERLA_BUILD_WITH_CODEGEN activated but pystencils or lbmpy package not found.
Please install lbmpy e.g.: 'pip3 install lbmpy'")
endif()
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from pystencils.include import get_pystencils_include_path; print(get_pystencils_include_path())"
execute_process(COMMAND ${Python_EXECUTABLE} -c "from pystencils.include import get_pystencils_include_path; print(get_pystencils_include_path())"
OUTPUT_VARIABLE PYSTENCILS_INCLUDE_PATH)
include_directories( ${PYSTENCILS_INCLUDE_PATH} )
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import jinja2"
execute_process(COMMAND ${Python_EXECUTABLE} -c "import jinja2"
RESULT_VARIABLE JINJA2_FOUND )
if(NOT JINJA2_FOUND EQUAL 0)
message(FATAL_ERROR "WALBERLA_BUILD_WITH_CODEGEN activated and jinja2 package not found.
......@@ -595,14 +619,6 @@ endif()
##
#############################################################################################################################
if ( WALBERLA_BUILD_WITH_PYTHON )
find_package( PythonInterp 3.6 QUIET REQUIRED)
find_package( PythonLibs QUIET REQUIRED)
if( NOT (PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR ) )
message( FATAL_ERROR "Couldn't find any python library" )
endif()
if(WALBERLA_CXX_COMPILER_IS_INTEL)
# Intel C++17 support introduced in 2.6.2 (https://github.com/pybind/pybind11/pull/2729)
set(PYBIND11_MINIMUM_VERSION "2.6.2")
......@@ -610,11 +626,11 @@ if ( WALBERLA_BUILD_WITH_PYTHON )
set(PYBIND11_MINIMUM_VERSION "2.6.0")
endif()
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import pybind11; print(pybind11._version.__version__)"
execute_process(COMMAND ${Python_EXECUTABLE} -c "import pybind11; print(pybind11._version.__version__)"
OUTPUT_VARIABLE pybind11_VERSION ERROR_QUIET RESULT_VARIABLE pybind11_VERSION_RESULT)
string(STRIP "${pybind11_VERSION}" pybind11_VERSION)
if(pybind11_VERSION_RESULT EQUAL "0" AND pybind11_VERSION VERSION_GREATER_EQUAL "${PYBIND11_MINIMUM_VERSION}")
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pybind11 --cmakedir
execute_process(COMMAND ${Python_EXECUTABLE} -m pybind11 --cmakedir
OUTPUT_VARIABLE PYBIND11_CMAKE_PATH)
string(STRIP "${PYBIND11_CMAKE_PATH}" PYBIND11_CMAKE_PATH)
find_package(pybind11 PATHS "${PYBIND11_CMAKE_PATH}" NO_DEFAULT_PATH REQUIRED)
......@@ -644,10 +660,10 @@ if ( WALBERLA_BUILD_WITH_PYTHON )
add_subdirectory(extern/pybind11)
if(pybind11_VERSION VERSION_LESS "2.6.2")
# if pybind11 was installed into ${PYTHON_INCLUDE_DIR} (e.g. by pip), that will have a higher priority than the Git submodule unless we reorder the search path
# if pybind11 was installed into ${Python_INCLUDE_DIRS} (e.g. by pip), that will have a higher priority than the Git submodule unless we reorder the search path
# introduced in 2.6.0 (https://github.com/pybind/pybind11/issues/2709), fixed in 2.6.2 (https://github.com/pybind/pybind11/pull/2716)
set_property( TARGET pybind11::pybind11
PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/extern/pybind11/include" "${PYTHON_INCLUDE_DIR}")
PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/extern/pybind11/include" "${Python_INCLUDE_DIRS}")
endif()
endif()
......@@ -837,6 +853,7 @@ option (WALBERLA_ENABLE_GUI "This flag builds the graphical user interface, depe
if ( WALBERLA_ENABLE_GUI )
message( WARNING "The GUI is deprecated and will probably not work correctly." )
find_package( Qt4 COMPONENTS QtCore QtGui QtOpenGL QtXml REQUIRED )
set( OpenGL_GL_PREFERENCE LEGACY )
find_package( OpenGL REQUIRED )
......@@ -939,6 +956,7 @@ if( (NOT DEFINED WALBERLA_BUILD_WITH_OPENMESH) OR WALBERLA_BUILD_WITH_OPENMESH )
add_definitions(-D_USE_MATH_DEFINES )
endif()
else()
message(" If OpenMesh required, set OPENMESH_DIR to the OpenMesh directory.")
set( WALBERLA_BUILD_WITH_OPENMESH OFF CACHE BOOL "Build with OpenMesh support" FORCE )
endif()
endif()
......@@ -1033,6 +1051,17 @@ if ( WALBERLA_BUILD_WITH_OPENMP )
message(FATAL_ERROR "Could NOT enable OpenMP")
endif()
endif()
if( WALBERLA_CXX_COMPILER_IS_CLANG OR WALBERLA_CXX_COMPILER_IS_INTELLLVM )
# check for bug in combination with OpenMP and sign conversion https://bugs.llvm.org/show_bug.cgi?id=48387
try_compile( WALBERLA_CLANG_OPENMP_BUG "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestClangOpenMPBug.cpp"
COMPILE_DEFINITIONS -Werror )
if( NOT ${WALBERLA_CLANG_OPENMP_BUG} )
message( WARNING "Setting -Wno-sign-conversion due to a compiler bug in LLVM (https://bugs.llvm.org/show_bug.cgi?id=48387)" )
add_flag( CMAKE_CXX_FLAGS "-Wno-sign-conversion" )
endif()
endif()
else()
if ( WALBERLA_CXX_COMPILER_IS_CRAY )
add_flag ( CMAKE_C_FLAGS "-h noomp" )
......@@ -1071,6 +1100,7 @@ if ( WALBERLA_BUILD_WITH_CUDA )
#CUDA_FOUND is need for our cmake mechanism
set ( CUDA_FOUND TRUE )
else()
message( WARNING "CUDA could not be enabled. The host compiler might not be compatible. Check CMakeFiles/CMakeError.log for more information" )
set ( WALBERLA_BUILD_WITH_CUDA FALSE )
endif ( )
endif ( )
......@@ -1085,6 +1115,13 @@ if (WALBERLA_BUILD_WITH_CUDA AND (CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "11.0
set(CMAKE_CUDA_STANDARD 14)
set(WALBERLA_USE_STD_EXPERIMENTAL_ANY 1)
endif()
# Can be used in CMake files containing generated files where the file suffix is dependent on the target
if (WALBERLA_BUILD_WITH_CUDA AND CUDA_FOUND)
set(CODEGEN_FILE_SUFFIX "cu")
else()
set(CODEGEN_FILE_SUFFIX "cpp")
endif()
############################################################################################################################
......
......@@ -26,6 +26,38 @@ build system. Furthermore, you need an MPI library (like
processing capabilities. All of these dependencies are typically available in
your operating system's package manager.
### CMake
The typical steps, assuming your are in the waLBerla source directory, are:
- `mkdir build; cd build` create a build directory and change into it
- `cmake ..` call CMake with the waLBerla source directory as an argument
- `make` build waLBerla
To specify a CMake option you need to use `-D(Option)=(Value)`. For example to set the C++ compiler one can use:
`cmake -DCMAKE_CXX_COMILER=clang++`
To list and modify the CMake options the `ccmake` tool can be used. Just call `ccmake .` in your **build** directory to see and change the
CMake options and variables.
Some important CMake variables:
- `WALBERLA_BUILD_WITH_CODEGEN` Enable pystencils code generation"
- `Python_ROOT_DIR` Specify the directory of the `python` executable. e.g. `~/miniconda/bin/`
- `MPI_HOME` Specify the base directory of the MPI installation.
- `WALBERLA_BUILD_WITH_PYTHON` Support for embedding Python
- `WALBERLA_BUILD_WITH_CUDA` Enable CUDA support
For a full list of CMake Option see the [CMakeLists.txt](CMakeLists.txt) file or use `ccmake` as described above.
### Codegen and Python
To use the `lbmpy`/`pystencils` code generation please install the packages with e.g. `pip3 install lbmpy` and specify the correct python
environment when calling CMake.
In previous versions of CMake one could use `PYTHON_EXECUTABLE` or `PYTHON_ROOT_DIR` (all upper case) to specify the python executable or
the directory. This does **NOT** work anymore. Please use `Python_ROOT_DIR`.
## Get involved
### Contributing
......@@ -48,29 +80,29 @@ Many thanks go to waLBerla's [contributors](AUTHORS.txt)
If you use waLBerla in a publication, please cite the following articles:
Overview:
- M. Bauer et al, *waLBerla: A block-structured high-performance framework for
multiphysics simulations*. Computers & Mathematics with Applications, 2020.
https://doi.org/10.1016/j.camwa.2020.01.007.
- M. Bauer et al, *waLBerla: A block-structured high-performance framework for
multiphysics simulations*. Computers & Mathematics with Applications, 2020.
https://doi.org/10.1016/j.camwa.2020.01.007.
Grid Refinement:
- F. Schornbaum and U. Rüde, *Massively parallel algorithms for the lattice boltzmann
method on nonuniform grids*. SIAM Journal on Scientific Computing, 2016.
https://doi.org/10.1137/15M1035240
- F. Schornbaum and U. Rüde, *Massively parallel algorithms for the lattice boltzmann
method on nonuniform grids*. SIAM Journal on Scientific Computing, 2016.
https://doi.org/10.1137/15M1035240
LBM - Particle Coupling:
- C. Rettinger and U. Rüde, *A comparative study of fluid-particle coupling methods for
fully resolved lattice Boltzmann simulations*. Computers & Fluids, 2017.
https://doi.org/10.1016/j.compfluid.2017.05.033
- C. Rettinger and U. Rüde, *A comparative study of fluid-particle coupling methods for
fully resolved lattice Boltzmann simulations*. Computers & Fluids, 2017.
https://doi.org/10.1016/j.compfluid.2017.05.033
MESA-PD:
- S. Eibl and U. Rüde, *A Modular and Extensible Software Architecture for Particle Dynamics*.
Proceedings Of The 8Th International Conference On Discrete Element Methods.
https://mercurylab.co.uk/dem8/full-papers/#page-content
- S. Eibl and U. Rüde, *A Modular and Extensible Software Architecture for Particle Dynamics*.
Proceedings Of The 8Th International Conference On Discrete Element Methods.
https://mercurylab.co.uk/dem8/full-papers/#page-content
Carbon Nanotubes:
- G. Drozdov et al, *Densification of single-walled carbon nanotube films:
Mesoscopic distinct element method simulations and experimental validation*.
Journal of Applied Physics, 2020. https://doi.org/10.1063/5.0025505
- G. Drozdov et al, *Densification of single-walled carbon nanotube films:
Mesoscopic distinct element method simulations and experimental validation*.
Journal of Applied Physics, 2020. https://doi.org/10.1063/5.0025505
## License
......
......@@ -1452,7 +1452,7 @@ int main( int argc, char **argv )
WALBERLA_LOG_INFO_ON_ROOT("Refreshing blockforest...")
// check refinement criterions and refine/coarsen if necessary
// check refinement criteria and refine/coarsen if necessary
uint_t stampBefore = blocks->getBlockForest().getModificationStamp();
blocks->refresh();
uint_t stampAfter = blocks->getBlockForest().getModificationStamp();
......@@ -2090,7 +2090,7 @@ int main( int argc, char **argv )
WALBERLA_LOG_INFO_ON_ROOT("Refreshing blockforest...")
// check refinement criterions and refine/coarsen if necessary
// check refinement criteria and refine/coarsen if necessary
uint_t stampBefore = blocks->getBlockForest().getModificationStamp();
blocks->refresh();
uint_t stampAfter = blocks->getBlockForest().getModificationStamp();
......
......@@ -929,7 +929,7 @@ int main( int argc, char **argv )
if( !useStaticRefinement && refinementCheckFrequency == 0 && numberOfLevels != 1 )
{
// determine check frequency automatically based on maximum admissable velocity and block sizes
// determine check frequency automatically based on maximum admissible velocity and block sizes
real_t uMax = real_t(0.1);
real_t refinementCheckFrequencyFinestLevel = ( overlap + real_c(blockSize) - real_t(2) * real_t(FieldGhostLayers) * dx) / uMax;
refinementCheckFrequency = uint_c( refinementCheckFrequencyFinestLevel / real_t(lbmTimeStepsPerTimeLoopIteration));
......@@ -1252,7 +1252,7 @@ int main( int argc, char **argv )
(*velocityCommunicationScheme)();
}
// check refinement criterions and refine/coarsen if necessary
// check refinement criteria and refine/coarsen if necessary
uint_t stampBefore = blocks->getBlockForest().getModificationStamp();
blocks->refresh();
uint_t stampAfter = blocks->getBlockForest().getModificationStamp();
......
......@@ -22,7 +22,7 @@ if ( WALBERLA_BUILD_WITH_PYTHON )
if ( WALBERLA_BUILD_WITH_CODEGEN )
add_subdirectory( FlowAroundSphereCodeGen )
add_subdirectory( UniformGridGenerated )
add_subdirectory( UniformGridCPU )
add_subdirectory( PhaseFieldAllenCahn )
endif()
......
......@@ -6,7 +6,7 @@ import os
class Parameter:
def __init__(self, name, type, defValue="", comment=""):
"""Propery of a data strcuture
"""Property of a data structure
Parameters
----------
......
......@@ -7,8 +7,8 @@ waLBerla_add_executable( NAME CouetteFlow DEPENDS blockforest boundary core fiel
# Some tests #
##############
waLBerla_execute_test( NO_MODULE_LABEL NAME CouetteFlowTestNoCheckRelease COMMAND $<TARGET_FILE:CouetteFlow> ${CMAKE_CURRENT_SOURCE_DIR}/TestNoCheck.dat --trt --linear-exp PROCESSES 4 CONFIGURATIONS Release RelWithDbgInfo )
waLBerla_execute_test( NO_MODULE_LABEL NAME CouetteFlowTestNoCheckDebug COMMAND $<TARGET_FILE:CouetteFlow> ${CMAKE_CURRENT_SOURCE_DIR}/TestNoCheck.dat --trt --linear-exp PROCESSES 4 LABELS longrun CONFIGURATIONS Debug DebugOptimized )
waLBerla_execute_test( NO_MODULE_LABEL NAME CouetteFlowTestNoCheckRelease COMMAND $<TARGET_FILE:CouetteFlow> ${CMAKE_CURRENT_SOURCE_DIR}/TestNoCheck.dat --trt --linear-exp PROCESSES 4 CONFIGURATIONS Release RelWithDbgInfo DEPENDS_ON_TARGETS CouetteFlow )
waLBerla_execute_test( NO_MODULE_LABEL NAME CouetteFlowTestNoCheckDebug COMMAND $<TARGET_FILE:CouetteFlow> ${CMAKE_CURRENT_SOURCE_DIR}/TestNoCheck.dat --trt --linear-exp PROCESSES 4 LABELS longrun CONFIGURATIONS Debug DebugOptimized DEPENDS_ON_TARGETS CouetteFlow )
waLBerla_execute_test( NO_MODULE_LABEL NAME CouetteFlowTest0 COMMAND $<TARGET_FILE:CouetteFlow> ${CMAKE_CURRENT_SOURCE_DIR}/Test0.dat --trt --linear-exp LABELS longrun CONFIGURATIONS Release RelWithDbgInfo )
waLBerla_execute_test( NO_MODULE_LABEL NAME CouetteFlowTest2 COMMAND $<TARGET_FILE:CouetteFlow> ${CMAKE_CURRENT_SOURCE_DIR}/Test2.dat --trt --linear-exp LABELS longrun verylongrun PROCESSES 4 CONFIGURATIONS Release RelWithDbgInfo )
waLBerla_execute_test( NO_MODULE_LABEL NAME CouetteFlowTest0 COMMAND $<TARGET_FILE:CouetteFlow> ${CMAKE_CURRENT_SOURCE_DIR}/Test0.dat --trt --linear-exp LABELS longrun CONFIGURATIONS Release RelWithDbgInfo DEPENDS_ON_TARGETS CouetteFlow )
waLBerla_execute_test( NO_MODULE_LABEL NAME CouetteFlowTest2 COMMAND $<TARGET_FILE:CouetteFlow> ${CMAKE_CURRENT_SOURCE_DIR}/Test2.dat --trt --linear-exp LABELS longrun verylongrun PROCESSES 4 CONFIGURATIONS Release RelWithDbgInfo DEPENDS_ON_TARGETS CouetteFlow )
waLBerla_link_files_to_builddir( "*.py" )
waLBerla_generate_target_from_python(NAME FlowAroundSphereGenerated
FILE FlowAroundSphereCodeGen.py
OUT_FILES FlowAroundSphereCodeGen_LbSweep.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_LbSweep.h
FlowAroundSphereCodeGen_MacroSetter.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_MacroSetter.h
FlowAroundSphereCodeGen_UBB.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_UBB.h
FlowAroundSphereCodeGen_NoSlip.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_NoSlip.h
FlowAroundSphereCodeGen_Outflow.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_Outflow.h
FlowAroundSphereCodeGen_PackInfoEven.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_PackInfoEven.h
FlowAroundSphereCodeGen_PackInfoOdd.${CODEGEN_FILE_SUFFIX} FlowAroundSphereCodeGen_PackInfoOdd.h
FlowAroundSphereCodeGen_InfoHeader.h)
if (WALBERLA_BUILD_WITH_CUDA)
waLBerla_generate_target_from_python(NAME FlowAroundSphereGenerated
FILE FlowAroundSphereCodeGen.py
OUT_FILES FlowAroundSphereCodeGen_LbSweep.cu FlowAroundSphereCodeGen_LbSweep.h
FlowAroundSphereCodeGen_MacroSetter.cu FlowAroundSphereCodeGen_MacroSetter.h
FlowAroundSphereCodeGen_UBB.cu FlowAroundSphereCodeGen_UBB.h
FlowAroundSphereCodeGen_NoSlip.cu FlowAroundSphereCodeGen_NoSlip.h
FlowAroundSphereCodeGen_Outflow.cu FlowAroundSphereCodeGen_Outflow.h
FlowAroundSphereCodeGen_PackInfoEven.cu FlowAroundSphereCodeGen_PackInfoEven.h
FlowAroundSphereCodeGen_PackInfoOdd.cu FlowAroundSphereCodeGen_PackInfoOdd.h
FlowAroundSphereCodeGen_InfoHeader.h)
waLBerla_add_executable( NAME FlowAroundSphereCodeGen FILE FlowAroundSphereCodeGen.cpp
DEPENDS blockforest boundary core domain_decomposition field geometry timeloop vtk FlowAroundSphereGenerated)
set_target_properties( FlowAroundSphereCodeGen PROPERTIES CXX_VISIBILITY_PRESET hidden)
DEPENDS blockforest boundary core cuda domain_decomposition field geometry python_coupling timeloop vtk FlowAroundSphereGenerated)
else ()
waLBerla_generate_target_from_python(NAME FlowAroundSphereGenerated
FILE FlowAroundSphereCodeGen.py
OUT_FILES FlowAroundSphereCodeGen_LbSweep.cpp FlowAroundSphereCodeGen_LbSweep.h
FlowAroundSphereCodeGen_MacroSetter.cpp FlowAroundSphereCodeGen_MacroSetter.h
FlowAroundSphereCodeGen_UBB.cpp FlowAroundSphereCodeGen_UBB.h
FlowAroundSphereCodeGen_NoSlip.cpp FlowAroundSphereCodeGen_NoSlip.h
FlowAroundSphereCodeGen_Outflow.cpp FlowAroundSphereCodeGen_Outflow.h
FlowAroundSphereCodeGen_PackInfoEven.cpp FlowAroundSphereCodeGen_PackInfoEven.h
FlowAroundSphereCodeGen_PackInfoOdd.cpp FlowAroundSphereCodeGen_PackInfoOdd.h
FlowAroundSphereCodeGen_InfoHeader.h)
waLBerla_add_executable( NAME FlowAroundSphereCodeGen FILE FlowAroundSphereCodeGen.cpp
DEPENDS blockforest boundary core domain_decomposition field geometry timeloop vtk FlowAroundSphereGenerated)
set_target_properties( FlowAroundSphereCodeGen PROPERTIES CXX_VISIBILITY_PRESET hidden)
endif()
\ No newline at end of file
DEPENDS blockforest boundary core domain_decomposition field geometry python_coupling timeloop vtk FlowAroundSphereGenerated)
endif (WALBERLA_BUILD_WITH_CUDA)
\ No newline at end of file
......@@ -73,21 +73,21 @@ auto VelocityCallback = [](const Cell& pos, const shared_ptr< StructuredBlockFor
real_t inflow_velocity, const bool constant_inflow = true) {
if (constant_inflow)
{
Vector3< real_t > result(inflow_velocity, 0.0, 0.0);
Vector3< real_t > result(inflow_velocity, real_c(0.0), real_c(0.0));
return result;
}
else
{
Cell globalCell;
CellInterval domain = SbF->getDomainCellBB();
real_t h_y = real_c(domain.ySize());
real_t h_z = real_c(domain.zSize());
auto h_y = real_c(domain.ySize());
auto h_z = real_c(domain.zSize());
SbF->transformBlockLocalToGlobalCell(globalCell, block, pos);
real_t y1 = real_c(globalCell[1] - (h_y / 2.0 - 0.5));
real_t z1 = real_c(globalCell[2] - (h_z / 2.0 - 0.5));
auto y1 = real_c(globalCell[1] - (h_y / 2.0 - 0.5));
auto z1 = real_c(globalCell[2] - (h_z / 2.0 - 0.5));
real_t u = (inflow_velocity * real_c(16)) / (h_y * h_y * h_z * h_z) * (h_y / real_c(2.0) - y1) *
real_t u = (inflow_velocity * real_c(16.0)) / (h_y * h_y * h_z * h_z) * (h_y / real_c(2.0) - y1) *
(h_y / real_c(2.0) + y1) * (h_z / real_c(2.0) - z1) * (h_z / real_c(2.0) + z1);
Vector3< real_t > result(u, 0.0, 0.0);
......@@ -151,9 +151,9 @@ int main(int argc, char** argv)
auto parameters = config->getOneBlock("Parameters");
const uint_t timesteps = parameters.getParameter< uint_t >("timesteps", uint_c(10));
const real_t omega = parameters.getParameter< real_t >("omega", real_t(1.9));
const real_t u_max = parameters.getParameter< real_t >("u_max", real_t(0.05));
const real_t reynolds_number = parameters.getParameter< real_t >("reynolds_number", real_t(1000));
const real_t omega = parameters.getParameter< real_t >("omega", real_c(1.9));
const real_t u_max = parameters.getParameter< real_t >("u_max", real_c(0.05));
const real_t reynolds_number = parameters.getParameter< real_t >("reynolds_number", real_c(1000.0));
const uint_t diameter_sphere = parameters.getParameter< uint_t >("diameter_sphere", uint_t(5));
const bool constant_inflow = parameters.getParameter< bool >("constant_inflow", true);
......@@ -162,8 +162,8 @@ int main(int argc, char** argv)
// create fields
BlockDataID pdfFieldID = blocks->addStructuredBlockData< PdfField_T >(pdfFieldAdder, "PDFs");
BlockDataID velFieldID = field::addToStorage< VelocityField_T >(blocks, "velocity", real_t(0), field::fzyx);
BlockDataID densityFieldID = field::addToStorage< ScalarField_T >(blocks, "density", real_t(0), field::fzyx);
BlockDataID velFieldID = field::addToStorage< VelocityField_T >(blocks, "velocity", real_c(0.0), field::fzyx);
BlockDataID densityFieldID = field::addToStorage< ScalarField_T >(blocks, "density", real_c(0.0), field::fzyx);
#if defined(WALBERLA_BUILD_WITH_CUDA)
BlockDataID pdfFieldIDGPU = cuda::addGPUFieldToStorage< PdfField_T >(blocks, pdfFieldID, "PDFs on GPU", true);
......@@ -300,7 +300,7 @@ int main(int argc, char** argv)
timeloop.run();
simTimer.end();
WALBERLA_LOG_INFO_ON_ROOT("Simulation finished")
auto time = simTimer.last();
auto time = real_c(simTimer.last());
auto nrOfCells = real_c(cellsPerBlock[0] * cellsPerBlock[1] * cellsPerBlock[2]);
auto mlupsPerProcess = nrOfCells * real_c(timesteps) / time * 1e-6;
WALBERLA_LOG_RESULT_ON_ROOT("MLUPS per process " << mlupsPerProcess)
......
from pystencils import Target
from pystencils.field import fields
from lbmpy import LBMConfig, LBMOptimisation, LBStencil, Method, Stencil
from lbmpy.advanced_streaming.utility import get_timesteps
from lbmpy.macroscopic_value_kernels import macroscopic_values_setter
from lbmpy.stencils import get_stencil
from lbmpy.creationfunctions import create_lb_collision_rule
from lbmpy.boundaries import NoSlip, UBB, ExtrapolationOutflow
from pystencils_walberla import CodeGeneration, generate_sweep, generate_info_header
from lbmpy_walberla.additional_data_handler import UBBAdditionalDataHandler, OutflowAdditionalDataHandler
from lbmpy_walberla import generate_boundary, generate_lb_pack_info
from lbmpy_walberla import generate_lb_pack_info
from lbmpy_walberla import generate_alternating_lbm_sweep, generate_alternating_lbm_boundary
import sympy as sp
with CodeGeneration() as ctx:
data_type = "float64" if ctx.double_accuracy else "float32"
stencil = get_stencil("D3Q27")
q = len(stencil)
dim = len(stencil[0])
stencil = LBStencil(Stencil.D3Q27)
q = stencil.Q
dim = stencil.D
streaming_pattern = 'esotwist'
timesteps = get_timesteps(streaming_pattern)
......@@ -32,21 +33,13 @@ with CodeGeneration() as ctx:
'velocity': velocity_field
}
opt = {'symbolic_field': pdfs,
'cse_global': False,
'cse_pdfs': False,
'double_precision': True if ctx.double_accuracy else False}
method_params = {'method': 'cumulant',
'stencil': stencil,
'relaxation_rate': omega,
'galilean_correction': True,
'field_name': 'pdfs',
'streaming_pattern': streaming_pattern,
'output': output,
'optimization': opt}
collision_rule = create_lb_collision_rule(**method_params)
lbm_config = LBMConfig(stencil=stencil, method=Method.CUMULANT, compressible=True,
relaxation_rate=omega, galilean_correction=True,
field_name='pdfs', streaming_pattern=streaming_pattern, output=output)
lbm_optimisation = LBMOptimisation(symbolic_field=pdfs, cse_global=False, cse_pdfs=False)
collision_rule = create_lb_collision_rule(lbm_config=lbm_config, lbm_optimisation=lbm_optimisation)
lb_method = collision_rule.method
# getter & setter
......@@ -63,33 +56,35 @@ with CodeGeneration() as ctx:
'ScalarField_T': density_field}
if ctx.cuda:
target = 'gpu'
target = Target.GPU
else:
target = 'cpu'
opt['target'] = target
target = Target.CPU
# sweeps
generate_alternating_lbm_sweep(ctx, 'FlowAroundSphereCodeGen_LbSweep',
collision_rule, streaming_pattern, optimization=opt)
collision_rule, lbm_config=lbm_config, lbm_optimisation=lbm_optimisation,
target=target)
generate_sweep(ctx, 'FlowAroundSphereCodeGen_MacroSetter', setter_assignments, target=target)
# boundaries
ubb = UBB(lambda *args: None, dim=dim)
ubb = UBB(lambda *args: None, dim=dim, data_type=data_type)
ubb_data_handler = UBBAdditionalDataHandler(stencil, ubb)
outflow = ExtrapolationOutflow(stencil[4], lb_method, streaming_pattern=streaming_pattern)
outflow = ExtrapolationOutflow(stencil[4], lb_method, streaming_pattern=streaming_pattern, data_type=data_type)
outflow_data_handler = OutflowAdditionalDataHandler(stencil, outflow, target=target)
generate_alternating_lbm_boundary(ctx, 'FlowAroundSphereCodeGen_UBB', ubb, lb_method,
target=target, streaming_pattern=streaming_pattern,
additional_data_handler=ubb_data_handler)
additional_data_handler=ubb_data_handler,
layout='fzyx')
generate_alternating_lbm_boundary(ctx, 'FlowAroundSphereCodeGen_NoSlip', NoSlip(), lb_method,
target=target, streaming_pattern=streaming_pattern)
target=target, streaming_pattern=streaming_pattern,
layout='fzyx')
generate_alternating_lbm_boundary(ctx, 'FlowAroundSphereCodeGen_Outflow', outflow, lb_method,
target=target, streaming_pattern=streaming_pattern,
additional_data_handler=outflow_data_handler)
additional_data_handler=outflow_data_handler,