Commit 241b9079 authored by Markus Holzer's avatar Markus Holzer
Browse files

Merge master

parents a88aee60 086dcd27
Pipeline #39961 failed with stages
in 4 minutes and 58 seconds
This diff is collapsed.
......@@ -371,13 +371,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" )
......@@ -493,7 +493,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 )
......@@ -502,14 +502,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 )
......@@ -518,14 +518,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()
......@@ -575,8 +576,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 ()
############################################################################################################################
##
......@@ -584,8 +597,6 @@ endif ( )
##
#############################################################################################################################
if ( WALBERLA_BUILD_WITH_CODEGEN )
set( Python_FIND_FRAMEWORK LAST )
find_package (Python COMPONENTS Interpreter Development)
execute_process(COMMAND ${Python_EXECUTABLE} -c "import lbmpy"
RESULT_VARIABLE LBMPY_FOUND )
if(NOT LBMPY_FOUND EQUAL 0)
......@@ -614,9 +625,6 @@ endif()
##
#############################################################################################################################
if ( WALBERLA_BUILD_WITH_PYTHON )
set( Python_FIND_FRAMEWORK LAST )
find_package( Python COMPONENTS Interpreter Development REQUIRED)
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")
......@@ -954,6 +962,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()
......@@ -1102,6 +1111,7 @@ if ( WALBERLA_BUILD_WITH_CUDA )
set ( CUDA_FOUND TRUE )
set (WALBERLA_BUILD_WITH_GPU_SUPPORT 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 ( )
......@@ -1116,6 +1126,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
......
......@@ -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()
......
waLBerla_link_files_to_builddir( "*.py" )
if ( WALBERLA_BUILD_WITH_CUDA )
set(SUFFIX "cu")
else()
set(SUFFIX "cpp")
endif()
waLBerla_generate_target_from_python(NAME FlowAroundSphereGenerated
FILE FlowAroundSphereCodeGen.py
OUT_FILES FlowAroundSphereCodeGen_LbSweep.${SUFFIX} FlowAroundSphereCodeGen_LbSweep.h
FlowAroundSphereCodeGen_MacroSetter.${SUFFIX} FlowAroundSphereCodeGen_MacroSetter.h
FlowAroundSphereCodeGen_UBB.${SUFFIX} FlowAroundSphereCodeGen_UBB.h
FlowAroundSphereCodeGen_NoSlip.${SUFFIX} FlowAroundSphereCodeGen_NoSlip.h
FlowAroundSphereCodeGen_Outflow.${SUFFIX} FlowAroundSphereCodeGen_Outflow.h
FlowAroundSphereCodeGen_PackInfoEven.${SUFFIX} FlowAroundSphereCodeGen_PackInfoEven.h
FlowAroundSphereCodeGen_PackInfoOdd.${SUFFIX} FlowAroundSphereCodeGen_PackInfoOdd.h
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)
# TODO: should we add cuda here if WALBERLA_BUILD_WITH_GPU_SUPPORT
waLBerla_add_executable( NAME FlowAroundSphereCodeGen FILE FlowAroundSphereCodeGen.cpp
DEPENDS blockforest boundary core domain_decomposition field geometry python_coupling timeloop vtk FlowAroundSphereGenerated)
\ No newline at end of file
if (WALBERLA_BUILD_WITH_CUDA)
waLBerla_add_executable( NAME FlowAroundSphereCodeGen FILE FlowAroundSphereCodeGen.cpp
DEPENDS blockforest boundary core cuda domain_decomposition field geometry python_coupling timeloop vtk FlowAroundSphereGenerated)
else ()
waLBerla_add_executable( NAME FlowAroundSphereCodeGen FILE FlowAroundSphereCodeGen.cpp
DEPENDS blockforest boundary core domain_decomposition field geometry python_coupling timeloop vtk FlowAroundSphereGenerated)
endif (WALBERLA_BUILD_WITH_CUDA)
......@@ -73,14 +73,17 @@ with CodeGeneration() as ctx:
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,
layout='fzyx')
# communication
generate_lb_pack_info(ctx, 'FlowAroundSphereCodeGen_PackInfo', stencil, pdfs,
......
......@@ -18,7 +18,6 @@
//
//======================================================================================================================
#include "Accessor.h"
#include "check.h"
#include "Contact.h"
#include "CreateParticles.h"
......@@ -32,7 +31,7 @@
#include <mesa_pd/collision_detection/AnalyticContactDetection.h>
#include <mesa_pd/data/LinkedCells.h>
#include <mesa_pd/data/ParticleAccessor.h>
#include <mesa_pd/data/ParticleAccessorWithShape.h>
#include <mesa_pd/data/ParticleStorage.h>
#include <mesa_pd/data/ShapeStorage.h>
#include <mesa_pd/domain/BlockForestDomain.h>
......@@ -90,7 +89,7 @@ public:
}
inline
void operator()(const size_t idx1, const size_t idx2, ParticleAccessorWithShape& ac)
void operator()(const size_t idx1, const size_t idx2, data::ParticleAccessorWithShape& ac)
{
++contactsChecked_;
......@@ -194,7 +193,7 @@ int main( int argc, char ** argv )
//init data structures
auto ps = std::make_shared<data::ParticleStorage>(100);
auto ss = std::make_shared<data::ShapeStorage>();
ParticleAccessorWithShape accessor(ps, ss);
data::ParticleAccessorWithShape accessor(ps, ss);
data::LinkedCells lc(localDomain.getExtended(params.spacing), params.spacing );
auto smallSphere = ss->create<data::Sphere>( params.radius );
......
......@@ -18,7 +18,6 @@
//
//======================================================================================================================
#include "Accessor.h"
#include "check.h"
#include "Contact.h"
#include "CreateParticles.h"
......@@ -32,7 +31,7 @@
#include <mesa_pd/collision_detection/AnalyticContactDetection.h>
#include <mesa_pd/data/LinkedCells.h>
#include <mesa_pd/data/ParticleAccessor.h>
#include <mesa_pd/data/ParticleAccessorWithShape.h>
#include <mesa_pd/data/ParticleStorage.h>
#include <mesa_pd/data/ShapeStorage.h>
#include <mesa_pd/domain/BlockForestDomain.h>
......@@ -209,7 +208,7 @@ int main( int argc, char ** argv )
//init data structures
auto ss = std::make_shared<data::ShapeStorage>();
auto ps = std::make_shared<data::ParticleStorage>(100);
ParticleAccessorWithShape accessor(ps, ss);
data::ParticleAccessorWithShape accessor(ps, ss);
data::LinkedCells lc(localDomain.getExtended(params.spacing), params.spacing );
auto smallSphere = ss->create<data::Sphere>( params.radius );
......
......@@ -18,7 +18,6 @@
//
//======================================================================================================================
#include "Accessor.h"
#include "check.h"
#include "Contact.h"
#include "CreateParticles.h"
......@@ -32,7 +31,7 @@
#include <mesa_pd/collision_detection/AnalyticContactDetection.h>
#include <mesa_pd/data/LinkedCells.h>
#include <mesa_pd/data/ParticleAccessor.h>
#include <mesa_pd/data/ParticleAccessorWithShape.h>
#include <mesa_pd/data/ParticleStorage.h>
#include <mesa_pd/data/ShapeStorage.h>
#include <mesa_pd/data/SparseLinkedCells.h>
......@@ -198,7 +197,7 @@ int main( int argc, char ** argv )
//init data structures
auto ps = std::make_shared<data::ParticleStorage>(100);
auto ss = std::make_shared<data::ShapeStorage>();
ParticleAccessorWithShape accessor(ps, ss);
data::ParticleAccessorWithShape accessor(ps, ss);
auto lc = std::make_shared<data::LinkedCells>(domain->getUnionOfLocalAABBs().getExtended(params.spacing), params.spacing );
forest->addBlockData(domain::createBlockForestDataHandling(ps), "Storage");
......
......@@ -18,7 +18,6 @@
//
//======================================================================================================================
#include "Accessor.h"
#include "check.h"
#include "Contact.h"
#include "CreateParticles.h"
......@@ -32,7 +31,7 @@
#include <mesa_pd/collision_detection/AnalyticContactDetection.h>
#include <mesa_pd/data/SparseLinkedCells.h>
#include <mesa_pd/data/ParticleAccessor.h>
#include <mesa_pd/data/ParticleAccessorWithShape.h>
#include <mesa_pd/data/ParticleStorage.h>
#include <mesa_pd/data/ShapeStorage.h>
#include <mesa_pd/data/STLOverloads.h>
......@@ -236,7 +235,7 @@ int main( int argc, char ** argv )
//init data structures
auto ps = std::make_shared<data::ParticleStorage>(100);
auto ss = std::make_shared<data::ShapeStorage>();
ParticleAccessorWithShape accessor(ps, ss);
data::ParticleAccessorWithShape accessor(ps, ss);
auto lc = std::make_shared<data::SparseLinkedCells>(domain->getUnionOfLocalAABBs().getExtended(params.spacing), params.spacing );
forest->addBlockData(domain::createBlockForestDataHandling(ps), "Storage");
......
......@@ -43,15 +43,15 @@ public:
const auto &getInvMass(const size_t /*p_idx*/) const
{ return invMass_; }
void setInvInertiaBF(const size_t /*p_idx*/, const Mat3 &val)
{ invInertiaBF_ = val; }
const auto &getInvInertiaBF(const size_t /*p_idx*/) const // dummy
{ return dummyI_; }
const auto &getInvInertiaBF(const size_t /*p_idx*/) const
{ return invInertiaBF_; }
const auto &getInertiaBF(const size_t /*p_idx*/) const // dummy
{ return dummyI_; }
private:
real_t invMass_;
Mat3 invInertiaBF_;
Mat3 dummyI_{0_r};
};
struct Oscillator
......
waLBerla_link_files_to_builddir(*.prm)
waLBerla_link_files_to_builddir(*.py)
if (WALBERLA_BUILD_WITH_CUDA)
waLBerla_generate_target_from_python(NAME BenchmarkPhaseFieldCodeGenGPU
FILE multiphase_codegen.py
OUT_FILES initialize_phase_field_distributions.cu initialize_phase_field_distributions.h
initialize_velocity_based_distributions.cu initialize_velocity_based_distributions.h
phase_field_LB_step.cu phase_field_LB_step.h
hydro_LB_step.cu hydro_LB_step.h
PackInfo_phase_field_distributions.cu PackInfo_phase_field_distributions.h
PackInfo_phase_field.cu PackInfo_phase_field.h
PackInfo_velocity_based_distributions.cu PackInfo_velocity_based_distributions.h
GenDefines.h)
waLBerla_generate_target_from_python(NAME BenchmarkPhaseFieldCodeGen
FILE multiphase_codegen.py
OUT_FILES initialize_phase_field_distributions.${CODEGEN_FILE_SUFFIX} initialize_phase_field_distributions.h
initialize_velocity_based_distributions.${CODEGEN_FILE_SUFFIX} initialize_velocity_based_distributions.h
phase_field_LB_step.${CODEGEN_FILE_SUFFIX} phase_field_LB_step.h
hydro_LB_step.${CODEGEN_FILE_SUFFIX} hydro_LB_step.h
PackInfo_phase_field_distributions.${CODEGEN_FILE_SUFFIX} PackInfo_phase_field_distributions.h
PackInfo_phase_field.${CODEGEN_FILE_SUFFIX} PackInfo_phase_field.h
PackInfo_velocity_based_distributions.${CODEGEN_FILE_SUFFIX} PackInfo_velocity_based_distributions.h
GenDefines.h)
if (WALBERLA_BUILD_WITH_CUDA)
waLBerla_add_executable(NAME benchmark_multiphase
FILES benchmark_multiphase.cpp InitializerFunctions.cpp multiphase_codegen.py
DEPENDS blockforest core cuda field postprocessing python_coupling lbm geometry timeloop gui BenchmarkPhaseFieldCodeGenGPU)
DEPENDS blockforest core cuda field postprocessing python_coupling lbm geometry timeloop gui BenchmarkPhaseFieldCodeGen)
else ()
waLBerla_generate_target_from_python(NAME BenchmarkPhaseFieldCodeGenCPU
FILE multiphase_codegen.py
OUT_FILES initialize_phase_field_distributions.cpp initialize_phase_field_distributions.h
initialize_velocity_based_distributions.cpp initialize_velocity_based_distributions.h
phase_field_LB_step.cpp phase_field_LB_step.h
hydro_LB_step.cpp hydro_LB_step.h
PackInfo_phase_field_distributions.cpp PackInfo_phase_field_distributions.h
PackInfo_phase_field.cpp PackInfo_phase_field.h
PackInfo_velocity_based_distributions.cpp PackInfo_velocity_based_distributions.h
GenDefines.h)
waLBerla_add_executable(NAME benchmark_multiphase
FILES benchmark_multiphase.cpp InitializerFunctions.cpp multiphase_codegen.py
DEPENDS blockforest core field postprocessing python_coupling lbm geometry timeloop gui BenchmarkPhaseFieldCodeGenCPU)
DEPENDS blockforest core field postprocessing python_coupling lbm geometry timeloop gui BenchmarkPhaseFieldCodeGen)
endif (WALBERLA_BUILD_WITH_CUDA)
waLBerla_link_files_to_builddir( "*.prm" )
waLBerla_link_files_to_builddir( "*.py" )
waLBerla_link_files_to_builddir( "simulation_setup" )
foreach(streaming_pattern pull push aa esotwist)
foreach(stencil d3q19 d3q27)
foreach (collision_setup srt trt mrt mrt-overrelax central central-overrelax cumulant cumulant-overrelax entropic smagorinsky)
# KBC methods only for D2Q9 and D3Q27 defined
if (${collision_setup} STREQUAL "entropic" AND ${stencil} STREQUAL "d3q19")
continue()
endif (${collision_setup} STREQUAL "entropic" AND ${stencil} STREQUAL "d3q19")
set(config ${stencil}_${streaming_pattern}_${collision_setup})
waLBerla_generate_target_from_python(NAME UniformGridCPUGenerated_${config}
FILE UniformGridCPU.py
CODEGEN_CFG ${config}
OUT_FILES UniformGridCPU_LbKernel.cpp UniformGridCPU_LbKernel.h
UniformGridCPU_PackInfoEven.cpp UniformGridCPU_PackInfoEven.h
UniformGridCPU_PackInfoOdd.cpp UniformGridCPU_PackInfoOdd.h
UniformGridCPU_NoSlip.cpp UniformGridCPU_NoSlip.h
UniformGridCPU_UBB.cpp UniformGridCPU_UBB.h
UniformGridCPU_MacroSetter.cpp UniformGridCPU_MacroSetter.h
UniformGridCPU_MacroGetter.cpp UniformGridCPU_MacroGetter.h
UniformGridCPU_StreamOnlyKernel.cpp UniformGridCPU_StreamOnlyKernel.h
UniformGridCPU_InfoHeader.h
)
waLBerla_add_executable(NAME UniformGridCPU_${config}
FILES UniformGridCPU.cpp
DEPENDS blockforest boundary core domain_decomposition field geometry python_coupling timeloop vtk UniformGridCPUGenerated_${config})
# all configs are excluded from all except for pull d3q27.
if (${streaming_pattern} STREQUAL "pull" AND ${stencil} STREQUAL "d3q27")
set_target_properties( UniformGridCPUGenerated_${config} PROPERTIES EXCLUDE_FROM_ALL FALSE)
set_target_properties( UniformGridCPU_${config} PROPERTIES EXCLUDE_FROM_ALL FALSE)
else()
set_target_properties( UniformGridCPUGenerated_${config} PROPERTIES EXCLUDE_FROM_ALL TRUE)
set_target_properties( UniformGridCPU_${config} PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif(${streaming_pattern} STREQUAL "pull" AND ${stencil} STREQUAL "d3q27")
endforeach ()
endforeach()
endforeach()
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file UniformGridCPU.cpp
//! \author Markus Holzer <markus.holzer@fau.de>
//
//======================================================================================================================
#include "blockforest/Initialization.h"
#include "blockforest/communication/UniformBufferedScheme.h"
#include "core/Environment.h"
#include "core/OpenMP.h"
#include "core/logging/Initialization.h"
#include "core/timing/RemainingTimeLogger.h"
#include "core/timing/TimingPool.h"
#include "domain_decomposition/SharedSweep.h"
#include "field/AddToStorage.h"
#include "field/vtk/VTKWriter.h"
#include "geometry/InitBoundaryHandling.h"
#include "lbm/communication/CombinedInPlaceCpuPackInfo.h"
#include "python_coupling/CreateConfig.h"
#include "python_coupling/DictWrapper.h"
#include "python_coupling/PythonCallback.h"
#include "timeloop/all.h"
#include <iomanip>
#include "InitShearVelocity.h"
#include "ManualKernels.h"
#include "UniformGridCPU_InfoHeader.h"
using namespace walberla;
using PackInfoEven_T = lbm::UniformGridCPU_PackInfoEven;
using PackInfoOdd_T = lbm::UniformGridCPU_PackInfoOdd;
using LbSweep = lbm::UniformGridCPU_LbKernel;
using FlagField_T = FlagField< uint8_t >;
auto pdfFieldAdder = [](IBlock* const block, StructuredBlockStorage* const storage) {
return new PdfField_T(storage->getNumberOfXCells(*block), storage->getNumberOfYCells(*block),
storage->getNumberOfZCells(*block), uint_t(1), field::fzyx,
make_shared< field::AllocateAligned< real_t, 64 > >());
};
int main(int argc, char** argv)
{
mpi::Environment env(argc, argv);
for (auto cfg = python_coupling::configBegin(argc, argv); cfg != python_coupling::configEnd(); ++cfg)
{
WALBERLA_MPI_WORLD_BARRIER()
auto config = *cfg;
logging::configureLogging(config);
auto blocks = blockforest::createUniformBlockGridFromConfig(config);
Vector3< uint_t > cellsPerBlock =
config->getBlock("DomainSetup").getParameter< Vector3< uint_t > >("cellsPerBlock");
// Reading parameters
auto parameters = config->getOneBlock("Parameters");
const real_t omega = parameters.getParameter< real_t >("omega", real_c(1.4));
const uint_t timesteps = parameters.getParameter< uint_t >("timesteps", uint_c(50));
const bool initShearFlow = parameters.getParameter< bool >("initShearFlow", true);
// Creating fields
BlockDataID pdfFieldId = blocks->addStructuredBlockData< PdfField_T >(pdfFieldAdder, "pdfs");
BlockDataID velFieldId = field::addToStorage< VelocityField_T >(blocks, "vel", real_t(0), field::fzyx);
BlockDataID densityFieldId = field::addToStorage< ScalarField_T >(blocks, "density", real_t(1.0), field::fzyx);
// Initialize velocity on cpu
if (initShearFlow)
{