Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (565)
Showing
with 1472 additions and 1489 deletions
...@@ -61,48 +61,54 @@ IncludeCategories: ...@@ -61,48 +61,54 @@ IncludeCategories:
Priority: 3 Priority: 3
- Regex: '^"core/' - Regex: '^"core/'
Priority: 4 Priority: 4
- Regex: '^"cuda/'
Priority: 5
- Regex: '^"domain_decomposition/' - Regex: '^"domain_decomposition/'
Priority: 6 Priority: 5
- Regex: '^"executiontree/' - Regex: '^"executiontree/'
Priority: 7 Priority: 6
- Regex: '^"fft/' - Regex: '^"fft/'
Priority: 8 Priority: 7
- Regex: '^"field/' - Regex: '^"field/'
Priority: 9 Priority: 8
- Regex: '^"gather/' - Regex: '^"gather/'
Priority: 10 Priority: 9
- Regex: '^"geometry/' - Regex: '^"geometry/'
Priority: 10
- Regex: '^"gpu/'
Priority: 11 Priority: 11
- Regex: '^"gui/' - Regex: '^"gpu/'
Priority: 12 Priority: 12
- Regex: '^"lbm/' - Regex: '^"lbm/'
Priority: 13 Priority: 13
- Regex: '^"mesh/' - Regex: '^"lbm_mesapd_coupling/'
Priority: 14 Priority: 14
- Regex: '^"pde/' - Regex: '^"mesh/'
Priority: 15 Priority: 15
- Regex: '^"pe/' - Regex: '^"mesa_pd/'
Priority: 16 Priority: 16
- Regex: '^"pe_coupling/' - Regex: '^"pde/'
Priority: 17 Priority: 17
- Regex: '^"postprocessing/' - Regex: '^"pe/'
Priority: 18 Priority: 18
- Regex: '^"python_coupling/' - Regex: '^"pe_coupling/'
Priority: 19 Priority: 19
- Regex: '^"simd/' - Regex: '^"postprocessing/'
Priority: 20 Priority: 20
- Regex: '^"stencil/' - Regex: '^"python_coupling/'
Priority: 21 Priority: 21
- Regex: '^"timeloop/' - Regex: '^"simd/'
Priority: 22 Priority: 22
- Regex: '^"vtk/' - Regex: '^"sqlite/'
Priority: 23 Priority: 23
- Regex: '^<boost/' - Regex: '^"stencil/'
Priority: 24 Priority: 24
- Regex: '^<' - Regex: '^"timeloop/'
Priority: 25 Priority: 25
- Regex: '^"vtk/'
Priority: 26
- Regex: '^<boost/'
Priority: 27
- Regex: '^<'
Priority: 28
IndentCaseLabels: false IndentCaseLabels: false
IndentPPDirectives: AfterHash IndentPPDirectives: AfterHash
IndentWidth: 3 IndentWidth: 3
......
...@@ -4,15 +4,30 @@ Checks: ' ...@@ -4,15 +4,30 @@ Checks: '
-*, -*,
boost-*, boost-*,
-boost-use-ranges,
bugprone-*, bugprone-*,
-bugprone-branch-clone, -bugprone-branch-clone,
-bugprone-exception-escape, -bugprone-exception-escape,
-bugprone-easily-swappable-parameters,
-bugprone-crtp-constructor-accessibility,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-macro-parentheses,
-bugprone-narrowing-conversions,
-bugprone-switch-missing-default-case,
-bugprone-assignment-in-if-condition,
-bugprone-reserved-identifier,
misc-*, misc-*,
-misc-misplaced-const, -misc-misplaced-const,
-misc-const-correctness,
-misc-unused-parameters,
-misc-no-recursion, -misc-no-recursion,
-misc-non-private-member-variables-in-classes, -misc-non-private-member-variables-in-classes,
-misc-include-cleaner,
-misc-header-include-cycle,
-misc-use-internal-linkage,
-misc-use-anonymous-namespace,
modernize-*, modernize-*,
-modernize-use-auto, -modernize-use-auto,
...@@ -22,12 +37,18 @@ modernize-*, ...@@ -22,12 +37,18 @@ modernize-*,
-modernize-use-using, -modernize-use-using,
-modernize-avoid-bind, -modernize-avoid-bind,
-modernize-return-braced-init-list, -modernize-return-braced-init-list,
-modernize-min-max-use-initializer-list,
-modernize-use-transparent-functors, -modernize-use-transparent-functors,
-modernize-redundant-void-arg, -modernize-redundant-void-arg,
-modernize-use-trailing-return-type, -modernize-use-trailing-return-type,
-modernize-use-default-member-init,
-modernize-use-equals-delete,
-modernize-macro-to-enum,
-modernize-avoid-c-arrays, -modernize-avoid-c-arrays,
-modernize-concat-nested-namespaces, -modernize-concat-nested-namespaces,
-modernize-use-nodiscard, -modernize-use-nodiscard,
-modernize-type-traits,
-modernize-make-shared,
mpi-*, mpi-*,
-mpi-type-mismatch, -mpi-type-mismatch,
...@@ -37,25 +58,26 @@ openmp-*, ...@@ -37,25 +58,26 @@ openmp-*,
-openmp-use-default-none, -openmp-use-default-none,
performance-*, performance-*,
-performance-enum-size,
-performance-noexcept-swap,
-performance-move-const-arg,
-performance-unnecessary-value-param,
-performance-avoid-endl,
-performance-no-int-to-ptr,
portability-*, portability-*,
readability-const-return-type,
readability-container-size-empty, readability-container-size-empty,
readability-delete-null-pointer, readability-delete-null-pointer,
readability-deleted-default, readability-deleted-default,
readability-isolate-declaration,
readability-misleading-indentation,
readability-misplaced-array-index, readability-misplaced-array-index,
readability-non-const-parameter, readability-non-const-parameter,
readability-redundant-access-specifiers,
readability-redundant-control-flow, readability-redundant-control-flow,
readability-redundant-declaration, readability-redundant-declaration,
readability-redundant-function-ptr-dereference, readability-redundant-function-ptr-dereference,
readability-redundant-preprocessor, readability-redundant-preprocessor,
readability-redundant-smartptr-get, readability-redundant-smartptr-get,
readability-redundant-string-cstr, readability-redundant-string-cstr,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr, readability-simplify-subscript-expr,
readability-static-accessed-through-instance, readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace, readability-static-definition-in-anonymous-namespace,
......
# See https://editorconfig.org/ # See https://editorconfig.org/
root = true # top-most .editorconfig-file # top-most .editorconfig-file
root = true
[*] [*]
tab_width = 3 tab_width = 3
...@@ -12,4 +13,4 @@ insert_final_newline = false ...@@ -12,4 +13,4 @@ insert_final_newline = false
[*.py] [*.py]
tab_width = 4 tab_width = 4
indent_size = 4 indent_size = 4
insert_final_newline = true insert_final_newline = true
\ No newline at end of file
...@@ -8,6 +8,10 @@ qrc_* ...@@ -8,6 +8,10 @@ qrc_*
# macOS # macOS
**/.DS_Store **/.DS_Store
# CLion indexing
*.uuid
.fleet
# Generated files # Generated files
*.out *.out
...@@ -29,9 +33,12 @@ qrc_* ...@@ -29,9 +33,12 @@ qrc_*
# Visual Studio Code # Visual Studio Code
/.vscode /.vscode
# Zed
/.cache*
# CLion # CLion
*.idea *.idea
*.clion*
# QtCreator # QtCreator
CMakeLists.txt.user.* CMakeLists.txt.user.*
...@@ -72,5 +79,11 @@ cmake_install.cmake ...@@ -72,5 +79,11 @@ cmake_install.cmake
CMakeDefs.h CMakeDefs.h
/moduleStatistics.json /moduleStatistics.json
/walberla-config.cmake /walberla-config.cmake
/cmake-build-debug/ cmake-build-*
/cmake-build-release/
# Virtual environments
.venv/
env/
venv/
ENV/
This diff is collapsed.
[submodule "extern/pybind11"]
path = extern/pybind11
url = https://github.com/pybind/pybind11.git
...@@ -31,6 +31,7 @@ Matthias Markl ...@@ -31,6 +31,7 @@ Matthias Markl
Michael Kuron Michael Kuron
Nils Kohl Nils Kohl
Paulo Carvalho Paulo Carvalho
Philipp Suffa
Regina Ammer Regina Ammer
Sagar Dolas Sagar Dolas
Sebastian Eibl Sebastian Eibl
......
# Changelog # Changelog
## [6.1] - 2022-07-25
### Added
- Free-surface LBM extension:
- Add implementation
- Add several showcases
- Add several tests
- LBM - MESA_PD coupling:
- Add partially saturated cells method (PSM)
- Add fluidized bed showcase
- Add virtual mass stabilization technique for light particles
- Add support for more shapes, e.g., convex polyhedron
- MESA_PD:
- Add extensive application for dense particle packing generation
- AMD - HIP support
- Support of the ROCm Toolchain and thus AMD HIP as second GPU language
- All CUDA related files, namespaces, folders etc are renamed to gpu.
- Include "GPUWrapper.h" to use general GPU functions cudaMalloc -> gpuMalloc
- WALBERLA_BUILD_WITH_HIP and WALBERLA_BUILD_WITH_GPU_SUPPORT as new CMake variables introduced
### Changed
- Update and extend phase-field LBM showcases
- Allow access to PDF centering information (for being used in generated LBM kernels)
- Adapt code generation backend to be compatible with pystencils 1.0 and lbmpy 1.0
- Required minimum dependencies:
- C++17-compliant compiler
- CMake 3.14
- pybind 2.6.2
- lbmpy 1.0
- pystencils 1.0
### Deprecated
- GUI
## [5.1] - 2020-04-09 ## [5.1] - 2020-04-09
### Added ### Added
- Add new tutorials and showcases - Add new tutorials and showcases
...@@ -71,4 +104,3 @@ ...@@ -71,4 +104,3 @@
### Deprecated ### Deprecated
- all dynamic level-wise balance functions (use the more general ones, without "level-wise") - all dynamic level-wise balance functions (use the more general ones, without "level-wise")
This diff is collapsed.
...@@ -26,6 +26,38 @@ build system. Furthermore, you need an MPI library (like ...@@ -26,6 +26,38 @@ build system. Furthermore, you need an MPI library (like
processing capabilities. All of these dependencies are typically available in processing capabilities. All of these dependencies are typically available in
your operating system's package manager. 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 ## Get involved
### Contributing ### Contributing
...@@ -48,29 +80,39 @@ Many thanks go to waLBerla's [contributors](AUTHORS.txt) ...@@ -48,29 +80,39 @@ Many thanks go to waLBerla's [contributors](AUTHORS.txt)
If you use waLBerla in a publication, please cite the following articles: If you use waLBerla in a publication, please cite the following articles:
Overview: Overview:
- M. Bauer et al, *waLBerla: A block-structured high-performance framework for - M. Bauer et al., *waLBerla: A block-structured high-performance framework for
multiphysics simulations*. Computers & Mathematics with Applications, 2020. multiphysics simulations*. Computers & Mathematics with Applications, 2020.
https://doi.org/10.1016/j.camwa.2020.01.007. https://doi.org/10.1016/j.camwa.2020.01.007.
Grid Refinement: Grid Refinement:
- F. Schornbaum and U. Rüde, *Massively parallel algorithms for the lattice boltzmann - F. Schornbaum and U. Rüde, *Massively parallel algorithms for the lattice boltzmann
method on nonuniform grids*. SIAM Journal on Scientific Computing, 2016. method on nonuniform grids*. SIAM Journal on Scientific Computing, 2016.
https://doi.org/10.1137/15M1035240 https://doi.org/10.1137/15M1035240
LBM - Particle Coupling: LBM - Particle Coupling:
- C. Rettinger and U. Rüde, *A comparative study of fluid-particle coupling methods for - C. Rettinger and U. Rüde, *A comparative study of fluid-particle coupling methods for
fully resolved lattice Boltzmann simulations*. Computers & Fluids, 2017. fully resolved lattice Boltzmann simulations*. Computers & Fluids, 2017.
https://doi.org/10.1016/j.compfluid.2017.05.033 https://doi.org/10.1016/j.compfluid.2017.05.033
Free-surface LBM:
- C. Schwarzmeier et al., *Comparison of free-surface and conservative Allen-Cahn phase-field
lattice Boltzmann method*. Journal of Computational Physics, 2023.
https://doi.org/10.1016/j.jcp.2022.111753
Allen-Cahn phase-field LBM
- M. Holzer et al., *Highly efficient lattice Boltzmann multiphase simulations of immiscible
fluids at high-density ratios on CPUs and GPUs through code generation*. The International Journal of High Performance Computing Applications, 2021.
https://doi.org/10.1177/10943420211016525
MESA-PD: MESA-PD:
- S. Eibl and U. Rüde, *A Modular and Extensible Software Architecture for Particle Dynamics*. - 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. Proceedings Of The 8Th International Conference On Discrete Element Methods.
https://mercurylab.co.uk/dem8/full-papers/#page-content https://mercurylab.co.uk/dem8/full-papers/#page-content
Carbon Nanotubes: Carbon Nanotubes:
- G. Drozdov et al, *Densification of single-walled carbon nanotube films: - G. Drozdov et al., *Densification of single-walled carbon nanotube films:
Mesoscopic distinct element method simulations and experimental validation*. Mesoscopic distinct element method simulations and experimental validation*.
Journal of Applied Physics, 2020. https://doi.org/10.1063/5.0025505 Journal of Applied Physics, 2020. https://doi.org/10.1063/5.0025505
## License ## License
......
...@@ -2,34 +2,26 @@ ...@@ -2,34 +2,26 @@
# Benchmarks # Benchmarks
if ( WALBERLA_BUILD_BENCHMARKS ) if ( WALBERLA_BUILD_BENCHMARKS )
add_subdirectory ( benchmarks ) add_subdirectory ( benchmarks )
else ()
add_subdirectory ( benchmarks EXCLUDE_FROM_ALL )
endif() endif()
# Tools # Tools
if ( WALBERLA_BUILD_TOOLS ) if ( WALBERLA_BUILD_TOOLS )
add_subdirectory ( tools ) add_subdirectory ( tools )
else ()
add_subdirectory ( tools EXCLUDE_FROM_ALL )
endif() endif()
# Tutorials # Tutorials
if ( WALBERLA_BUILD_TUTORIALS ) if ( WALBERLA_BUILD_TUTORIALS )
add_subdirectory ( tutorials ) add_subdirectory ( tutorials )
else ()
add_subdirectory ( tutorials EXCLUDE_FROM_ALL )
endif() endif()
# Showcases # Showcases
if ( WALBERLA_BUILD_SHOWCASES ) if ( WALBERLA_BUILD_SHOWCASES )
add_subdirectory ( showcases ) add_subdirectory ( showcases )
else ()
add_subdirectory ( showcases EXCLUDE_FROM_ALL )
endif() endif()
# Python module # Python module
if ( WALBERLA_BUILD_WITH_PYTHON ) if ( WALBERLA_BUILD_WITH_PYTHON )
add_subdirectory( pythonmodule ) add_subdirectory( pythonmodule )
endif() endif()
\ No newline at end of file
...@@ -20,8 +20,14 @@ ...@@ -20,8 +20,14 @@
//====================================================================================================================== //======================================================================================================================
#include "blockforest/Initialization.h" #include "blockforest/Initialization.h"
#include "blockforest/communication/UniformBufferedScheme.h" #include "blockforest/loadbalancing/InfoCollection.h"
#include "blockforest/loadbalancing/all.h" #include "blockforest/loadbalancing/DynamicCurve.h"
#include "blockforest/loadbalancing/DynamicDiffusive.h"
#include "blockforest/loadbalancing/DynamicParMetis.h"
#include "blockforest/loadbalancing/StaticCurve.h"
#include "blockforest/loadbalancing/StaticParMetis.h"
#include "blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h"
#include "blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h"
#include "blockforest/AABBRefinementSelection.h" #include "blockforest/AABBRefinementSelection.h"
#include "boundary/all.h" #include "boundary/all.h"
...@@ -35,7 +41,6 @@ ...@@ -35,7 +41,6 @@
#include "core/timing/RemainingTimeLogger.h" #include "core/timing/RemainingTimeLogger.h"
#include "core/mpi/Broadcast.h" #include "core/mpi/Broadcast.h"
#include "domain_decomposition/SharedSweep.h"
#include "domain_decomposition/BlockSweepWrapper.h" #include "domain_decomposition/BlockSweepWrapper.h"
#include "field/AddToStorage.h" #include "field/AddToStorage.h"
...@@ -43,26 +48,21 @@ ...@@ -43,26 +48,21 @@
#include "field/communication/PackInfo.h" #include "field/communication/PackInfo.h"
#include "lbm/boundary/all.h" #include "lbm/boundary/all.h"
#include "lbm/communication/PdfFieldPackInfo.h"
#include "lbm/field/AddToStorage.h" #include "lbm/field/AddToStorage.h"
#include "lbm/field/PdfField.h" #include "lbm/field/PdfField.h"
#include "lbm/field/VelocityFieldWriter.h" #include "lbm/field/VelocityFieldWriter.h"
#include "lbm/lattice_model/D3Q19.h" #include "lbm/lattice_model/D3Q19.h"
#include "lbm/refinement/all.h" #include "lbm/refinement/all.h"
#include "lbm/sweeps/CellwiseSweep.h" #include "lbm/sweeps/CellwiseSweep.h"
#include "lbm/sweeps/SweepWrappers.h"
#include "pe/basic.h" #include "pe/basic.h"
#include "pe/Types.h" #include "pe/Types.h"
#include "pe/fcd/GJKEPACollideFunctor.h" #include "pe/fcd/GJKEPACollideFunctor.h"
#include "pe/vtk/BodyVtkOutput.h"
#include "pe/vtk/SphereVtkOutput.h" #include "pe/vtk/SphereVtkOutput.h"
#include "pe/vtk/EllipsoidVtkOutput.h" #include "pe/vtk/EllipsoidVtkOutput.h"
#include "pe/cr/ICR.h" #include "pe/cr/ICR.h"
#include "pe/synchronization/ClearSynchronization.h" #include "pe/synchronization/ClearSynchronization.h"
#include "pe/amr/InfoCollection.h" #include "pe/amr/InfoCollection.h"
#include "pe/amr/weight_assignment/WeightAssignmentFunctor.h"
#include "pe/amr/weight_assignment/MetisAssignmentFunctor.h"
#include "pe_coupling/amr/all.h" #include "pe_coupling/amr/all.h"
#include "pe_coupling/mapping/all.h" #include "pe_coupling/mapping/all.h"
...@@ -1452,7 +1452,7 @@ int main( int argc, char **argv ) ...@@ -1452,7 +1452,7 @@ int main( int argc, char **argv )
WALBERLA_LOG_INFO_ON_ROOT("Refreshing blockforest...") 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(); uint_t stampBefore = blocks->getBlockForest().getModificationStamp();
blocks->refresh(); blocks->refresh();
uint_t stampAfter = blocks->getBlockForest().getModificationStamp(); uint_t stampAfter = blocks->getBlockForest().getModificationStamp();
...@@ -1492,17 +1492,17 @@ int main( int argc, char **argv ) ...@@ -1492,17 +1492,17 @@ int main( int argc, char **argv )
LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega, lbm::collision_model::TRT::threeSixteenth, finestLevel ) ); LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega, lbm::collision_model::TRT::threeSixteenth, finestLevel ) );
// add PDF field // add PDF field
BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (fzyx)", latticeModel,
Vector3< real_t >( real_t(0) ), real_t(1), Vector3< real_t >( real_t(0) ), real_t(1),
FieldGhostLayers, field::zyxf ); FieldGhostLayers, field::fzyx );
// add flag field // add flag field
BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers );
// add body field // add body field
BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf, FieldGhostLayers ); BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::fzyx, FieldGhostLayers );
// add velocity field and utility // add velocity field and utility
BlockDataID velocityFieldID = field::addToStorage<VelocityField_T>( blocks, "velocity field", Vector3<real_t>(real_t(0)), field::zyxf, uint_t(2) ); BlockDataID velocityFieldID = field::addToStorage<VelocityField_T>( blocks, "velocity field", Vector3<real_t>(real_t(0)), field::fzyx, uint_t(2) );
using VelocityFieldWriter_T = lbm::VelocityFieldWriter<PdfField_T, VelocityField_T>; using VelocityFieldWriter_T = lbm::VelocityFieldWriter<PdfField_T, VelocityField_T>;
BlockSweepWrapper< VelocityFieldWriter_T > velocityFieldWriter( blocks, VelocityFieldWriter_T( pdfFieldID, velocityFieldID ) ); BlockSweepWrapper< VelocityFieldWriter_T > velocityFieldWriter( blocks, VelocityFieldWriter_T( pdfFieldID, velocityFieldID ) );
...@@ -1616,7 +1616,7 @@ int main( int argc, char **argv ) ...@@ -1616,7 +1616,7 @@ int main( int argc, char **argv )
} }
else if( loadEvaluationStrategy == "PE" ) else if( loadEvaluationStrategy == "PE" )
{ {
pe::amr::WeightAssignmentFunctor weightAssignmentFunctor(peInfoCollection, peBlockBaseWeight ); blockforest::WeightAssignmentFunctor weightAssignmentFunctor(peInfoCollection, peBlockBaseWeight );
blockforest.setRefreshPhantomBlockDataAssignmentFunction(weightAssignmentFunctor); blockforest.setRefreshPhantomBlockDataAssignmentFunction(weightAssignmentFunctor);
} }
else if( loadEvaluationStrategy == "LBM" ) else if( loadEvaluationStrategy == "LBM" )
...@@ -1700,7 +1700,7 @@ int main( int argc, char **argv ) ...@@ -1700,7 +1700,7 @@ int main( int argc, char **argv )
} }
else if( loadEvaluationStrategy == "PE" ) else if( loadEvaluationStrategy == "PE" )
{ {
pe::amr::MetisAssignmentFunctor weightAssignmentFunctor(peInfoCollection, peBlockBaseWeight ); blockforest::MetisAssignmentFunctor weightAssignmentFunctor(peInfoCollection, peBlockBaseWeight );
blockforest.setRefreshPhantomBlockDataAssignmentFunction(weightAssignmentFunctor); blockforest.setRefreshPhantomBlockDataAssignmentFunction(weightAssignmentFunctor);
} }
else if( loadEvaluationStrategy == "LBM" ) else if( loadEvaluationStrategy == "LBM" )
...@@ -1743,7 +1743,7 @@ int main( int argc, char **argv ) ...@@ -1743,7 +1743,7 @@ int main( int argc, char **argv )
} }
else if( loadEvaluationStrategy == "PE" ) else if( loadEvaluationStrategy == "PE" )
{ {
pe::amr::WeightAssignmentFunctor weightAssignmentFunctor(peInfoCollection, peBlockBaseWeight ); blockforest::WeightAssignmentFunctor weightAssignmentFunctor(peInfoCollection, peBlockBaseWeight );
blockforest.setRefreshPhantomBlockDataAssignmentFunction(weightAssignmentFunctor); blockforest.setRefreshPhantomBlockDataAssignmentFunction(weightAssignmentFunctor);
} }
else if( loadEvaluationStrategy == "LBM" ) else if( loadEvaluationStrategy == "LBM" )
...@@ -2090,7 +2090,7 @@ int main( int argc, char **argv ) ...@@ -2090,7 +2090,7 @@ int main( int argc, char **argv )
WALBERLA_LOG_INFO_ON_ROOT("Refreshing blockforest...") 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(); uint_t stampBefore = blocks->getBlockForest().getModificationStamp();
blocks->refresh(); blocks->refresh();
uint_t stampAfter = blocks->getBlockForest().getModificationStamp(); uint_t stampAfter = blocks->getBlockForest().getModificationStamp();
......
...@@ -498,13 +498,8 @@ public: ...@@ -498,13 +498,8 @@ public:
WALBERLA_MPI_SECTION() WALBERLA_MPI_SECTION()
{ {
mpi::allReduceInplace( pos[0], mpi::SUM ); mpi::allReduceInplace( pos, mpi::SUM );
mpi::allReduceInplace( pos[1], mpi::SUM ); mpi::allReduceInplace( transVel, mpi::SUM );
mpi::allReduceInplace( pos[2], mpi::SUM );
mpi::allReduceInplace( transVel[0], mpi::SUM );
mpi::allReduceInplace( transVel[1], mpi::SUM );
mpi::allReduceInplace( transVel[2], mpi::SUM );
} }
position_ = pos[2]; position_ = pos[2];
...@@ -929,7 +924,7 @@ int main( int argc, char **argv ) ...@@ -929,7 +924,7 @@ int main( int argc, char **argv )
if( !useStaticRefinement && refinementCheckFrequency == 0 && numberOfLevels != 1 ) 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 uMax = real_t(0.1);
real_t refinementCheckFrequencyFinestLevel = ( overlap + real_c(blockSize) - real_t(2) * real_t(FieldGhostLayers) * dx) / uMax; real_t refinementCheckFrequencyFinestLevel = ( overlap + real_c(blockSize) - real_t(2) * real_t(FieldGhostLayers) * dx) / uMax;
refinementCheckFrequency = uint_c( refinementCheckFrequencyFinestLevel / real_t(lbmTimeStepsPerTimeLoopIteration)); refinementCheckFrequency = uint_c( refinementCheckFrequencyFinestLevel / real_t(lbmTimeStepsPerTimeLoopIteration));
...@@ -982,17 +977,17 @@ int main( int argc, char **argv ) ...@@ -982,17 +977,17 @@ int main( int argc, char **argv )
LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega, lbm::collision_model::TRT::threeSixteenth, finestLevel ) ); LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega, lbm::collision_model::TRT::threeSixteenth, finestLevel ) );
// add PDF field // add PDF field
BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (fzyx)", latticeModel,
Vector3< real_t >( real_t(0) ), real_t(1), Vector3< real_t >( real_t(0) ), real_t(1),
FieldGhostLayers, field::zyxf ); FieldGhostLayers, field::fzyx );
// add flag field // add flag field
BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers );
// add body field // add body field
BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf, FieldGhostLayers ); BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::fzyx, FieldGhostLayers );
// add velocity field and utility // add velocity field and utility
BlockDataID velocityFieldID = field::addToStorage<VelocityField_T>( blocks, "velocity field", Vector3<real_t>(real_t(0)), field::zyxf, uint_t(2) ); BlockDataID velocityFieldID = field::addToStorage<VelocityField_T>( blocks, "velocity field", Vector3<real_t>(real_t(0)), field::fzyx, uint_t(2) );
using VelocityFieldWriter_T = lbm::VelocityFieldWriter<PdfField_T, VelocityField_T>; using VelocityFieldWriter_T = lbm::VelocityFieldWriter<PdfField_T, VelocityField_T>;
BlockSweepWrapper< VelocityFieldWriter_T > velocityFieldWriter( blocks, VelocityFieldWriter_T( pdfFieldID, velocityFieldID ) ); BlockSweepWrapper< VelocityFieldWriter_T > velocityFieldWriter( blocks, VelocityFieldWriter_T( pdfFieldID, velocityFieldID ) );
...@@ -1252,7 +1247,7 @@ int main( int argc, char **argv ) ...@@ -1252,7 +1247,7 @@ int main( int argc, char **argv )
(*velocityCommunicationScheme)(); (*velocityCommunicationScheme)();
} }
// check refinement criterions and refine/coarsen if necessary // check refinement criteria and refine/coarsen if necessary
uint_t stampBefore = blocks->getBlockForest().getModificationStamp(); uint_t stampBefore = blocks->getBlockForest().getModificationStamp();
blocks->refresh(); blocks->refresh();
uint_t stampAfter = blocks->getBlockForest().getModificationStamp(); uint_t stampAfter = blocks->getBlockForest().getModificationStamp();
......
waLBerla_add_executable( NAME WorkloadEvaluation FILES WorkloadEvaluation.cpp DEPENDS blockforest boundary core field lbm pe pe_coupling postprocessing stencil timeloop vtk ) waLBerla_add_executable( NAME WorkloadEvaluation FILES WorkloadEvaluation.cpp DEPENDS walberla::blockforest walberla::boundary walberla::core walberla::field walberla::lbm walberla::pe walberla::pe_coupling walberla::postprocessing walberla::stencil walberla::timeloop walberla::vtk )
waLBerla_add_executable( NAME AMRSedimentSettling FILES AMRSedimentSettling.cpp DEPENDS blockforest boundary core field lbm pe pe_coupling postprocessing stencil timeloop vtk ) waLBerla_add_executable( NAME AMRSedimentSettling FILES AMRSedimentSettling.cpp DEPENDS walberla::blockforest walberla::boundary walberla::core walberla::field walberla::lbm walberla::pe walberla::pe_coupling walberla::postprocessing walberla::stencil walberla::timeloop walberla::vtk )
waLBerla_add_executable( NAME AMRSettlingSphere FILES AMRSettlingSphere.cpp DEPENDS blockforest boundary core field lbm pe pe_coupling postprocessing stencil timeloop vtk ) waLBerla_add_executable( NAME AMRSettlingSphere FILES AMRSettlingSphere.cpp DEPENDS walberla::blockforest walberla::boundary walberla::core walberla::field walberla::lbm walberla::pe walberla::pe_coupling walberla::postprocessing walberla::stencil walberla::timeloop walberla::vtk )
...@@ -682,15 +682,15 @@ int main( int argc, char **argv ) ...@@ -682,15 +682,15 @@ int main( int argc, char **argv )
LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega ) ); LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega ) );
// add PDF field // add PDF field
BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (fzyx)", latticeModel,
Vector3< real_t >( real_t(0) ), real_t(1), Vector3< real_t >( real_t(0) ), real_t(1),
uint_t(1), field::zyxf ); uint_t(1), field::fzyx );
// add flag field // add flag field
BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" );
// add body field // add body field
BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf ); BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::fzyx );
// add boundary handling & initialize outer domain boundaries // add boundary handling & initialize outer domain boundaries
BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >(
......
...@@ -4,9 +4,12 @@ add_subdirectory( ComplexGeometry ) ...@@ -4,9 +4,12 @@ add_subdirectory( ComplexGeometry )
add_subdirectory( DEM ) add_subdirectory( DEM )
add_subdirectory( MeshDistance ) add_subdirectory( MeshDistance )
add_subdirectory( CouetteFlow ) add_subdirectory( CouetteFlow )
add_subdirectory( FreeSurfaceAdvection )
add_subdirectory( FluidizedBed )
add_subdirectory( FluidParticleCoupling ) add_subdirectory( FluidParticleCoupling )
add_subdirectory( FluidParticleCouplingWithLoadBalancing ) add_subdirectory( FluidParticleCouplingWithLoadBalancing )
add_subdirectory( ForcesOnSphereNearPlaneInShearFlow ) add_subdirectory( ForcesOnSphereNearPlaneInShearFlow )
add_subdirectory(Percolation)
add_subdirectory( GranularGas ) add_subdirectory( GranularGas )
add_subdirectory( IntegratorAccuracy ) add_subdirectory( IntegratorAccuracy )
add_subdirectory( LennardJones ) add_subdirectory( LennardJones )
...@@ -21,12 +24,15 @@ if ( WALBERLA_BUILD_WITH_PYTHON ) ...@@ -21,12 +24,15 @@ if ( WALBERLA_BUILD_WITH_PYTHON )
add_subdirectory( FieldCommunication ) add_subdirectory( FieldCommunication )
if ( WALBERLA_BUILD_WITH_CODEGEN ) if ( WALBERLA_BUILD_WITH_CODEGEN )
add_subdirectory( UniformGridGenerated ) add_subdirectory( UniformGridCPU )
add_subdirectory( PhaseFieldAllenCahn ) add_subdirectory( PhaseFieldAllenCahn )
add_subdirectory( NonUniformGridCPU )
add_subdirectory( TurbulentChannel )
endif() endif()
if ( WALBERLA_BUILD_WITH_CODEGEN AND WALBERLA_BUILD_WITH_CUDA ) if ( WALBERLA_BUILD_WITH_CODEGEN AND WALBERLA_BUILD_WITH_GPU_SUPPORT )
add_subdirectory( UniformGridGPU ) add_subdirectory( UniformGridGPU )
add_subdirectory( NonUniformGridGPU )
endif() endif()
endif() endif()
......
...@@ -7,4 +7,4 @@ waLBerla_add_executable( NAME 01_cnt_film ...@@ -7,4 +7,4 @@ waLBerla_add_executable( NAME 01_cnt_film
InitializeCNTs.cpp InitializeCNTs.cpp
SQLProperties.cpp SQLProperties.cpp
Statistics.cpp Statistics.cpp
DEPENDS blockforest core mesa_pd sqlite vtk ) DEPENDS walberla::blockforest walberla::core walberla::mesa_pd walberla::sqlite walberla::vtk )
...@@ -6,7 +6,7 @@ import os ...@@ -6,7 +6,7 @@ import os
class Parameter: class Parameter:
def __init__(self, name, type, defValue="", comment=""): def __init__(self, name, type, defValue="", comment=""):
"""Propery of a data strcuture """Property of a data structure
Parameters Parameters
---------- ----------
......
if ( WALBERLA_BUILD_WITH_OPENMESH ) if ( WALBERLA_BUILD_WITH_OPENMESH )
waLBerla_link_geometry_to_builddir( "*.obj" )
waLBerla_link_files_to_builddir( "*.conf" )
waLBerla_link_files_to_builddir( "*.obj" ) waLBerla_add_executable( NAME ComplexGeometry FILES ComplexGeometry.cpp DEPENDS walberla::boundary walberla::core walberla::lbm walberla::mesh walberla::vtk )
waLBerla_link_files_to_builddir( "*.conf" )
waLBerla_add_executable( NAME ComplexGeometry FILES ComplexGeometry.cpp DEPENDS boundary core lbm mesh vtk )
############## ##############
# Some tests # # Some tests #
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
//! \file ComplexGeometry.cpp //! \file ComplexGeometry.cpp
//! \ingroup mesh //! \ingroup mesh
//! \author Christian Godenschwager <christian.godenschwager@fau.de> //! \author Christian Godenschwager <christian.godenschwager@fau.de>
//! \author Markus Holzer <markus.holzer@fau.de>
// //
//====================================================================================================================== //======================================================================================================================
...@@ -84,181 +85,208 @@ ...@@ -84,181 +85,208 @@
#include "mesh_common/vtk/CommonDataSources.h" #include "mesh_common/vtk/CommonDataSources.h"
#include "mesh_common/vtk/VTKMeshWriter.h" #include "mesh_common/vtk/VTKMeshWriter.h"
namespace walberla { namespace walberla
{
template< typename MeshType > template< typename MeshType >
void vertexToFaceColor( MeshType & mesh, const typename MeshType::Color & defaultColor ) void vertexToFaceColor(MeshType& mesh, const typename MeshType::Color& defaultColor)
{ {
WALBERLA_CHECK( mesh.has_vertex_colors() ); WALBERLA_CHECK(mesh.has_vertex_colors())
mesh.request_face_colors(); mesh.request_face_colors();
for( auto faceIt = mesh.faces_begin(); faceIt != mesh.faces_end(); ++faceIt ) for (auto faceIt = mesh.faces_begin(); faceIt != mesh.faces_end(); ++faceIt)
{ {
typename MeshType::Color vertexColor; typename MeshType::Color vertexColor;
bool useVertexColor = true; bool useVertexColor = true;
auto vertexIt = mesh.fv_iter( *faceIt ); auto vertexIt = mesh.fv_iter(*faceIt);
WALBERLA_ASSERT( vertexIt.is_valid() ); WALBERLA_ASSERT(vertexIt.is_valid())
vertexColor = mesh.color( *vertexIt ); vertexColor = mesh.color(*vertexIt);
++vertexIt; ++vertexIt;
while( vertexIt.is_valid() && useVertexColor ) while (vertexIt.is_valid() && useVertexColor)
{ {
if( vertexColor != mesh.color( *vertexIt ) ) if (vertexColor != mesh.color(*vertexIt)) useVertexColor = false;
useVertexColor = false;
++vertexIt; ++vertexIt;
} }
mesh.set_color( *faceIt, useVertexColor ? vertexColor : defaultColor ); mesh.set_color(*faceIt, useVertexColor ? vertexColor : defaultColor);
} }
} }
int main(int argc, char* argv[])
int main( int argc, char * argv[] )
{ {
Environment env( argc, argv ); Environment env(argc, argv);
if( !env.config() ) if (!env.config()) { WALBERLA_ABORT_NO_DEBUG_INFO("USAGE: " << argv[0] << " INPUT_FILE") }
{
WALBERLA_ABORT_NO_DEBUG_INFO( "USAGE: " << argv[0] << " INPUT_FILE" );
}
mpi::MPIManager::instance()->useWorldComm(); mpi::MPIManager::instance()->useWorldComm();
const auto & config = *( env.config() ); const auto& config = *(env.config());
Config::BlockHandle configBlock = config.getOneBlock( "ComplexGeometry" ); Config::BlockHandle configBlock = config.getOneBlock("ComplexGeometry");
const std::string meshFile = configBlock.getParameter< std::string >( "meshFile" ); const std::string meshFile = configBlock.getParameter< std::string >("meshFile");
const real_t dx = configBlock.getParameter< real_t >( "coarseDx" ); const real_t dx = configBlock.getParameter< real_t >("coarseDx");
const real_t omega = configBlock.getParameter< real_t >( "coarseOmega" ); const real_t omega = configBlock.getParameter< real_t >("coarseOmega");
//const uint_t blockPerProcess = configBlock.getParameter< uint_t >( "blocksPerProcess", uint_t(6) );
const uint_t timeSteps = configBlock.getParameter< uint_t >( "coarseTimeSteps" );
const Vector3<real_t> bodyForce = configBlock.getParameter< Vector3<real_t> >( "bodyForce" );
//const bool sparseCommunication = configBlock.getParameter< bool >( "sparseCommunication", true );
const Vector3<real_t> domainBlowUp = configBlock.getParameter< Vector3<real_t> >( "domainBlowUp", Vector3<real_t>(6) );
const Vector3<uint_t> blockSize = configBlock.getParameter< Vector3<uint_t> >( "blockSize", Vector3<uint_t>(16) );
uint_t numLevels = configBlock.getParameter< uint_t >( "numLevels", uint_t(2) );
numLevels = std::max( numLevels, uint_t(1) ); if (configBlock.getParameter< bool >("logLevelDetail"))
walberla::logging::Logging::instance()->setLogLevel(walberla::logging::Logging::DETAIL);
//uint_t numProcesses = uint_c( MPIManager::instance()->numProcesses() ); const uint_t timeSteps = configBlock.getParameter< uint_t >("coarseTimeSteps");
const Vector3< real_t > bodyForce = configBlock.getParameter< Vector3< real_t > >("bodyForce");
const Vector3< real_t > domainBlowUp =
configBlock.getParameter< Vector3< real_t > >("domainBlowUp", Vector3< real_t >(6));
const Vector3< uint_t > blockSize =
configBlock.getParameter< Vector3< uint_t > >("blockSize", Vector3< uint_t >(16));
uint_t numLevels = configBlock.getParameter< uint_t >("numLevels", uint_t(2));
const bool WriteDistanceOctree = configBlock.getParameter< bool >("WriteDistanceOctree", false);
const bool WriteSetupForestAndReturn = configBlock.getParameter< bool >("WriteSetupForestAndReturn", false);
WALBERLA_LOG_DEVEL_VAR_ON_ROOT( meshFile ); numLevels = std::max(numLevels, uint_t(1));
const real_t fineDX = dx / real_c(std::pow(2, numLevels));
// uint_t numProcesses = uint_c( MPIManager::instance()->numProcesses() );
WALBERLA_LOG_DEVEL_VAR_ON_ROOT(meshFile)
auto mesh = make_shared< mesh::TriangleMesh >(); auto mesh = make_shared< mesh::TriangleMesh >();
mesh->request_vertex_colors(); mesh->request_vertex_colors();
WALBERLA_LOG_DEVEL_ON_ROOT( "Loading mesh" ); WALBERLA_LOG_DEVEL_ON_ROOT("Loading mesh")
mesh::readAndBroadcast( meshFile, *mesh); mesh::readAndBroadcast(meshFile, *mesh);
vertexToFaceColor( *mesh, mesh::TriangleMesh::Color(255,255,255) ); vertexToFaceColor(*mesh, mesh::TriangleMesh::Color(255, 255, 255));
WALBERLA_LOG_DEVEL_ON_ROOT("Adding distance info to mesh")
auto triDist = make_shared< mesh::TriangleDistance< mesh::TriangleMesh > >(mesh);
WALBERLA_LOG_DEVEL_ON_ROOT("Building distance octree")
auto distanceOctree = make_shared< mesh::DistanceOctree< mesh::TriangleMesh > >(triDist);
WALBERLA_LOG_DEVEL_ON_ROOT("done. Octree has height " << distanceOctree->height())
// write distance octree to file
if (WriteDistanceOctree) {
distanceOctree->writeVTKOutput("distanceOctree");
}
WALBERLA_LOG_DEVEL_ON_ROOT( "Adding distance info to mesh" ); auto aabb = computeAABB(*mesh);
auto triDist = make_shared< mesh::TriangleDistance<mesh::TriangleMesh> >( mesh ); aabb.scale(domainBlowUp);
WALBERLA_LOG_DEVEL_ON_ROOT( "Building distance octree" );
auto distanceOctree = make_shared< mesh::DistanceOctree<mesh::TriangleMesh> >( triDist );
WALBERLA_LOG_DEVEL_ON_ROOT( "done. Octree has height " << distanceOctree->height() );
distanceOctree->writeVTKOutput("distanceOctree"); mesh::ComplexGeometryStructuredBlockforestCreator bfc(aabb, Vector3< real_t >(dx));
auto aabb = computeAABB( *mesh ); bfc.setRootBlockExclusionFunction(mesh::makeExcludeMeshInterior(distanceOctree, dx));
aabb.scale( domainBlowUp ); bfc.setBlockExclusionFunction(mesh::makeExcludeMeshInteriorRefinement(distanceOctree, fineDX));
mesh::ComplexGeometryStructuredBlockforestCreator bfc( aabb, Vector3<real_t>( dx ), mesh::makeExcludeMeshInterior( distanceOctree, dx ) ); auto meshWorkloadMemory = mesh::makeMeshWorkloadMemory(distanceOctree, dx);
auto meshWorkloadMemory = mesh::makeMeshWorkloadMemory( distanceOctree, dx );
meshWorkloadMemory.setInsideCellWorkload(1); meshWorkloadMemory.setInsideCellWorkload(1);
meshWorkloadMemory.setOutsideCellWorkload(1); meshWorkloadMemory.setOutsideCellWorkload(1);
bfc.setWorkloadMemorySUIDAssignmentFunction( meshWorkloadMemory ); bfc.setWorkloadMemorySUIDAssignmentFunction(meshWorkloadMemory);
bfc.setPeriodicity( Vector3<bool>(true) ); bfc.setPeriodicity(Vector3< bool >(true));
bfc.setRefinementSelectionFunction( makeRefinementSelection( distanceOctree, numLevels - uint_t(1), dx, dx * real_t(1) ) ); bfc.setRefinementSelectionFunction(
makeRefinementSelection(distanceOctree, numLevels - uint_t(1), dx, dx * real_t(1)));
auto structuredBlockforest = bfc.createStructuredBlockForest( blockSize ); if (WriteSetupForestAndReturn)
{
WALBERLA_LOG_INFO_ON_ROOT("Setting up SetupBlockForest")
auto setupForest = bfc.createSetupBlockForest(blockSize);
WALBERLA_LOG_INFO_ON_ROOT("Writing SetupBlockForest to VTK file")
WALBERLA_ROOT_SECTION()
{
setupForest->writeVTKOutput("SetupBlockForest");
}
WALBERLA_LOG_INFO_ON_ROOT("Stopping program")
return EXIT_SUCCESS;
}
auto structuredBlockforest = bfc.createStructuredBlockForest(blockSize);
typedef lbm::D3Q19<lbm::collision_model::SRT, false, lbm::force_model::SimpleConstant> LatticeModel_T; typedef lbm::D3Q19< lbm::collision_model::SRT, false, lbm::force_model::SimpleConstant > LatticeModel_T;
using flag_t = walberla::uint8_t; using flag_t = walberla::uint8_t;
using FlagField_T = FlagField<flag_t>; using FlagField_T = FlagField< flag_t >;
using PdfField_T = lbm::PdfField<LatticeModel_T>; using PdfField_T = lbm::PdfField< LatticeModel_T >;
LatticeModel_T latticeModel{ lbm::collision_model::SRT( omega ), lbm::force_model::SimpleConstant( bodyForce ) }; LatticeModel_T latticeModel{ lbm::collision_model::SRT(omega), lbm::force_model::SimpleConstant(bodyForce) };
static const uint_t NUM_GHOSTLAYERS = 4; static const uint_t NUM_GHOSTLAYERS = 4;
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( structuredBlockforest, "pdf field", latticeModel, Vector3<real_t>(0), real_t(1), NUM_GHOSTLAYERS, field::fzyx ); BlockDataID pdfFieldId = lbm::addPdfFieldToStorage(structuredBlockforest, "pdf field", latticeModel,
BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( structuredBlockforest, "flag field", NUM_GHOSTLAYERS ); Vector3< real_t >(0), real_t(1), NUM_GHOSTLAYERS, field::fzyx);
BlockDataID flagFieldId =
field::addFlagFieldToStorage< FlagField_T >(structuredBlockforest, "flag field", NUM_GHOSTLAYERS);
const FlagUID fluidFlagUID( "Fluid" ); const FlagUID fluidFlagUID("Fluid");
typedef lbm::DefaultBoundaryHandlingFactory< LatticeModel_T, FlagField_T > BHFactory; typedef lbm::DefaultBoundaryHandlingFactory< LatticeModel_T, FlagField_T > BHFactory;
auto boundariesConfig = configBlock.getOneBlock( "Boundaries" ); auto boundariesConfig = configBlock.getOneBlock("Boundaries");
BlockDataID boundaryHandlingId = BHFactory::addBoundaryHandlingToStorage( structuredBlockforest, "boundary handling", flagFieldId, pdfFieldId, fluidFlagUID, BlockDataID boundaryHandlingId = BHFactory::addBoundaryHandlingToStorage(
boundariesConfig.getParameter< Vector3<real_t> >( "velocity0", Vector3<real_t>() ), structuredBlockforest, "boundary handling", flagFieldId, pdfFieldId, fluidFlagUID,
boundariesConfig.getParameter< Vector3<real_t> >( "velocity1", Vector3<real_t>() ), boundariesConfig.getParameter< Vector3< real_t > >("velocity0", Vector3< real_t >()),
boundariesConfig.getParameter< real_t > ( "pressure0", real_c( 1.0 ) ), boundariesConfig.getParameter< Vector3< real_t > >("velocity1", Vector3< real_t >()),
boundariesConfig.getParameter< real_t > ( "pressure1", real_c( 1.001 ) ) ); boundariesConfig.getParameter< real_t >("pressure0", real_c(1.0)),
boundariesConfig.getParameter< real_t >("pressure1", real_c(1.001)));
mesh::ColorToBoundaryMapper<mesh::TriangleMesh> colorToBoundryMapper(( mesh::BoundaryInfo( BHFactory::getNoSlipBoundaryUID() ) )); mesh::ColorToBoundaryMapper< mesh::TriangleMesh > colorToBoundryMapper(
(mesh::BoundaryInfo(BHFactory::getNoSlipBoundaryUID())));
// colorToBoundryMapper.set( mesh::TriangleMesh::Color(255,0,0), mesh::BoundaryInfo( BHFactory::getPressure0BoundaryUID() ) ); // colorToBoundryMapper.set( mesh::TriangleMesh::Color(255,0,0), mesh::BoundaryInfo(
// colorToBoundryMapper.set( mesh::TriangleMesh::Color(0,0,255), mesh::BoundaryInfo( BHFactory::getPressure1BoundaryUID() ) ); // BHFactory::getPressure0BoundaryUID() ) ); colorToBoundryMapper.set( mesh::TriangleMesh::Color(0,0,255),
// colorToBoundryMapper.set( mesh::TriangleMesh::Color(255,255,255), mesh::BoundaryInfo( BHFactory::getNoSlipBoundaryUID() ) ); // mesh::BoundaryInfo( BHFactory::getPressure1BoundaryUID() ) ); colorToBoundryMapper.set(
// mesh::TriangleMesh::Color(255,255,255), mesh::BoundaryInfo( BHFactory::getNoSlipBoundaryUID() ) );
auto boundaryLocations = colorToBoundryMapper.addBoundaryInfoToMesh( *mesh ); auto boundaryLocations = colorToBoundryMapper.addBoundaryInfoToMesh(*mesh);
mesh::VTKMeshWriter< mesh::TriangleMesh > meshWriter( mesh, "meshBoundaries", 1 ); mesh::VTKMeshWriter< mesh::TriangleMesh > meshWriter(mesh, "meshBoundaries", 1);
meshWriter.addDataSource( make_shared< mesh::BoundaryUIDFaceDataSource< mesh::TriangleMesh > >( boundaryLocations ) ); meshWriter.addDataSource(make_shared< mesh::BoundaryUIDFaceDataSource< mesh::TriangleMesh > >(boundaryLocations));
meshWriter.addDataSource( make_shared< mesh::ColorFaceDataSource< mesh::TriangleMesh > >() ); meshWriter.addDataSource(make_shared< mesh::ColorFaceDataSource< mesh::TriangleMesh > >());
meshWriter.addDataSource( make_shared< mesh::ColorVertexDataSource< mesh::TriangleMesh > >() ); meshWriter.addDataSource(make_shared< mesh::ColorVertexDataSource< mesh::TriangleMesh > >());
meshWriter(); meshWriter();
WALBERLA_LOG_DEVEL_ON_ROOT( "Voxelizing mesh" ); WALBERLA_LOG_DEVEL_ON_ROOT("Voxelizing mesh")
mesh::BoundarySetup boundarySetup( structuredBlockforest, makeMeshDistanceFunction( distanceOctree ), NUM_GHOSTLAYERS ); mesh::BoundarySetup boundarySetup(structuredBlockforest, makeMeshDistanceFunction(distanceOctree), NUM_GHOSTLAYERS);
//WALBERLA_LOG_DEVEL( "Writing Voxelisation" ); // WALBERLA_LOG_DEVEL( "Writing Voxelisation" );
//boundarySetup.writeVTKVoxelfile(); // boundarySetup.writeVTKVoxelfile();
WALBERLA_LOG_DEVEL_ON_ROOT( "Setting up fluid cells" ); WALBERLA_LOG_DEVEL_ON_ROOT("Setting up fluid cells")
boundarySetup.setDomainCells<BHFactory::BoundaryHandling>( boundaryHandlingId, mesh::BoundarySetup::OUTSIDE ); boundarySetup.setDomainCells< BHFactory::BoundaryHandling >(boundaryHandlingId, mesh::BoundarySetup::OUTSIDE);
WALBERLA_LOG_DEVEL_ON_ROOT( "Setting up boundaries" ); WALBERLA_LOG_DEVEL_ON_ROOT("Setting up boundaries")
boundarySetup.setBoundaries<BHFactory::BoundaryHandling>( boundaryHandlingId, makeBoundaryLocationFunction( distanceOctree, boundaryLocations ), mesh::BoundarySetup::INSIDE ); boundarySetup.setBoundaries< BHFactory::BoundaryHandling >(
WALBERLA_LOG_DEVEL_ON_ROOT( "done" ); boundaryHandlingId, makeBoundaryLocationFunction(distanceOctree, boundaryLocations), mesh::BoundarySetup::INSIDE);
WALBERLA_LOG_DEVEL_ON_ROOT("done")
lbm::BlockForestEvaluation<FlagField_T>( structuredBlockforest, flagFieldId, fluidFlagUID ).logInfoOnRoot(); lbm::BlockForestEvaluation< FlagField_T >(structuredBlockforest, flagFieldId, fluidFlagUID).logInfoOnRoot();
lbm::PerformanceLogger<FlagField_T> perfLogger( structuredBlockforest, flagFieldId, fluidFlagUID, 100 ); lbm::PerformanceLogger< FlagField_T > perfLogger(structuredBlockforest, flagFieldId, fluidFlagUID, 100);
SweepTimeloop timeloop( structuredBlockforest->getBlockStorage(), timeSteps ); SweepTimeloop timeloop(structuredBlockforest->getBlockStorage(), timeSteps);
auto sweep = lbm::makeCellwiseSweep< LatticeModel_T, FlagField_T >( pdfFieldId, flagFieldId, fluidFlagUID ); auto sweep = lbm::makeCellwiseSweep< LatticeModel_T, FlagField_T >(pdfFieldId, flagFieldId, fluidFlagUID);
auto refinementTimeStep = lbm::refinement::makeTimeStep<LatticeModel_T, BHFactory::BoundaryHandling > ( structuredBlockforest, sweep, pdfFieldId, boundaryHandlingId ); auto refinementTimeStep = lbm::refinement::makeTimeStep< LatticeModel_T, BHFactory::BoundaryHandling >(
timeloop.addFuncBeforeTimeStep( makeSharedFunctor( refinementTimeStep ), "Refinement time step" ); structuredBlockforest, sweep, pdfFieldId, boundaryHandlingId);
timeloop.addFuncBeforeTimeStep(makeSharedFunctor(refinementTimeStep), "Refinement time step");
// log remaining time // log remaining time
timeloop.addFuncAfterTimeStep( timing::RemainingTimeLogger( timeloop.getNrOfTimeSteps() ), "remaining time logger" ); timeloop.addFuncAfterTimeStep(timing::RemainingTimeLogger(timeloop.getNrOfTimeSteps()), "remaining time logger");
// LBM stability check // LBM stability check
timeloop.addFuncAfterTimeStep( makeSharedFunctor( field::makeStabilityChecker< PdfField_T, FlagField_T >( env.config(), structuredBlockforest, pdfFieldId, timeloop.addFuncAfterTimeStep(makeSharedFunctor(field::makeStabilityChecker< PdfField_T, FlagField_T >(
flagFieldId, fluidFlagUID ) ), env.config(), structuredBlockforest, pdfFieldId, flagFieldId, fluidFlagUID)),
"LBM stability check" ); "LBM stability check");
timeloop.addFuncAfterTimeStep( perfLogger, "PerformanceLogger" );
timeloop.addFuncAfterTimeStep(perfLogger, "Evaluator: performance logging");
// add VTK output to time loop // add VTK output to time loop
lbm::VTKOutput< LatticeModel_T, FlagField_T >::addToTimeloop( timeloop, structuredBlockforest, env.config(), pdfFieldId, flagFieldId, fluidFlagUID ); lbm::VTKOutput< LatticeModel_T, FlagField_T >::addToTimeloop(timeloop, structuredBlockforest, env.config(),
pdfFieldId, flagFieldId, fluidFlagUID);
WcTimingPool timingPool; WcTimingPool timingPool;
WALBERLA_LOG_INFO_ON_ROOT( "Starting timeloop" ); WALBERLA_LOG_INFO_ON_ROOT("Starting timeloop")
timeloop.run( timingPool ); timeloop.run(timingPool);
WALBERLA_LOG_INFO_ON_ROOT( "Timeloop done" ); WALBERLA_LOG_INFO_ON_ROOT("Timeloop done")
timingPool.unifyRegisteredTimersAcrossProcesses(); timingPool.unifyRegisteredTimersAcrossProcesses();
timingPool.logResultOnRoot( timing::REDUCE_TOTAL, true ); timingPool.logResultOnRoot(timing::REDUCE_TOTAL, true);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
} // namespace walberla } // namespace walberla
int main( int argc, char * argv[] ) int main(int argc, char* argv[]) { return walberla::main(argc, argv); }
{
return walberla::main( argc, argv );
}