Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface Walberla LB #2701

Closed
wants to merge 1,803 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
1803 commits
Select commit Hold shift + click to select a range
6b6136e
CI: Small fix
jngrad Aug 2, 2022
528bb1e
walberla: Remove VTK code duplication
jngrad Aug 3, 2022
cc2b64b
walberla: Include what you use and fix Clang warnings
jngrad Aug 3, 2022
2e31fad
walberla: Fix destructor bugs in abstract classes
jngrad Aug 3, 2022
ba9690f
ekin: Add clear_*_boundary() methods and tests
jngrad Aug 3, 2022
b08cc55
walberla: Harmonize VTK and boundaries with ekin, add documentation
jngrad Aug 3, 2022
cfbc574
ekin: Remove unused code
jngrad Aug 3, 2022
6d23ad5
walberla: Move VTK to new LatticeModel base class
jngrad Aug 3, 2022
554e83e
walberla: Roll out get_lattice() method
jngrad Aug 3, 2022
247e76a
walberla: Declutter class definitions
jngrad Aug 3, 2022
201e62b
doc: Fix links
jngrad Aug 3, 2022
f02c236
ekin: Include what you use
jngrad Aug 3, 2022
e5db51e
ekin: Test runtime errors
jngrad Aug 3, 2022
deb4ea9
ekin: Remove unused code
jngrad Aug 3, 2022
4cc66ab
ekin: Formatting
jngrad Aug 3, 2022
7c9f7bc
CI: Small fixes
jngrad Aug 3, 2022
2ad0109
ekin: Test invalid combinations
jngrad Aug 3, 2022
76a5b1d
Formatting
jngrad Aug 4, 2022
c0a0ecc
ekin: Automatically generate switch statement
jngrad Aug 4, 2022
82632c3
Formatting
jngrad Aug 4, 2022
4075cb7
core: Fix regressions
jngrad Aug 4, 2022
cc49c68
walberla: Write common lattice node interface
jngrad Aug 4, 2022
238066f
walberla: Merge the LB and EK slice classes
jngrad Aug 4, 2022
b22c978
ekin: Naming convention for abstract classes
jngrad Aug 4, 2022
3ae4566
ekin: Remove unused code
jngrad Aug 4, 2022
0dd8972
ekin: Check node equality
jngrad Aug 4, 2022
7a4b6bc
walberla: Move set_boundary_from_shape() to free functions
jngrad Aug 5, 2022
2644b43
walberla: Use LB namespace
jngrad Aug 5, 2022
8360332
walberla: Fix regression
jngrad Aug 5, 2022
b36cd66
Merge branch 'python' into walberla
jngrad Aug 8, 2022
2dd1147
python: Fix merge regressions
jngrad Aug 8, 2022
afc81a0
Merge branch 'python' into walberla
jngrad Aug 15, 2022
0a5035c
CMake: Fix regressions
jngrad Aug 15, 2022
7282ab4
walberla: Unify thermalized and unthermalized kernels
jngrad Aug 15, 2022
1b2863d
Merge branch 'python' into walberla
jngrad Aug 18, 2022
65510f2
py: don't ignore Lees Edwards shift in system.distance_vec and system…
RudolfWeeber Aug 23, 2022
2ca84b7
pitchforkize walberla
christophlohrmann Aug 23, 2022
fdda32f
Complete remaining Pitchfork tasks, fix regressions
jngrad Aug 24, 2022
46585cd
walberla: Refactor reactions interface
jngrad Aug 24, 2022
d053b12
Merge branch 'python' into walberla
jngrad Aug 24, 2022
826be7f
Merge branch 'walberla' into walberla
jngrad Aug 24, 2022
452d17d
walberla: Disable failing test
jngrad Aug 24, 2022
02ef2fd
walberla: Fix more regressions
jngrad Aug 24, 2022
5719389
WIP: LE decrapification
RudolfWeeber Aug 24, 2022
5d1b76d
Revert "py: don't ignore Lees Edwards shift in system.distance_vec an…
RudolfWeeber Aug 25, 2022
df34e65
Core: Always fold share_plane_normal dir in Lees Edwards get_mi_vector
RudolfWeeber Aug 25, 2022
07084e2
Merge branch 'walberla' into le_decrapification
RudolfWeeber Aug 25, 2022
1eb204b
Revert "walberla: Disable failing test"
RudolfWeeber Aug 25, 2022
46a7105
Merge branch 'le_decrapification' into walberla
RudolfWeeber Aug 25, 2022
1570b47
WIP: LE
RudolfWeeber Aug 25, 2022
93f3880
WIP: Simplify VS_Relative, fix VS support for Lees Edwards
RudolfWeeber Sep 5, 2022
a565412
Merge branch 'vs_rel_simplification' into le_decrapification
RudolfWeeber Sep 5, 2022
ea828b1
Merge branch 'python' into walberla
jngrad Sep 13, 2022
c3f2f8a
script_interface: Make MPI communicator public
jngrad Sep 13, 2022
dfaeb20
script_interface: Make main analysis methods parallel
jngrad Sep 13, 2022
4b1d38f
script_interface: Remove dependency on core/communication.hpp
jngrad Sep 13, 2022
794341d
Fix various regressions found by Clang
jngrad Sep 13, 2022
eb3a3c4
Merge branch 'python' into walberla
jngrad Sep 20, 2022
a9d2473
python: Remove unused bindings
jngrad Oct 11, 2022
9073290
Fix regressions
jngrad Oct 12, 2022
5483521
CMake: Fix FetchContent regression
jngrad Oct 14, 2022
d94cde6
walberla: Make Ekin opt-in
jngrad Oct 14, 2022
590f7ab
Revert "walberla: Make Ekin opt-in"
jngrad Oct 16, 2022
54198a7
walberla: Make fft opt-in
jngrad Oct 16, 2022
8704213
CMake: Fix PNFFT dependency
jngrad Oct 18, 2022
60deb51
Fix issues revealed by Clang 14 and CMake 3.22
jngrad Oct 18, 2022
d088f2e
Merge branch 'python' into walberla
jngrad Oct 18, 2022
559708d
walberla: Re-enable LB sedimentation test
jngrad Oct 19, 2022
53ba66f
Merge branch 'walberla' of ssh://github.com/RudolfWeeber/espresso int…
RudolfWeeber Oct 21, 2022
070f97f
Merge branch 'le_decrapification' of ssh://github.com/RudolfWeeber/es…
RudolfWeeber Oct 21, 2022
8071163
walberla: Fix broken url
jngrad Oct 21, 2022
7f8f812
Merge commit 'refs/pull/4564/head' of ssh://github.com/espressomd/esp…
RudolfWeeber Oct 21, 2022
ec89b92
Merge branch 'walberla' of ssh://github.com/RudolfWeeber/espresso int…
RudolfWeeber Oct 21, 2022
921c5d4
core: Fix Clang-Tidy warnings
jngrad Oct 24, 2022
b783784
walberla: Regenerate kernels with latest pystencils
jngrad Oct 24, 2022
26edccc
walberla: Regenerate kernels with latest pystencils and lbmpy
jngrad Oct 25, 2022
36c5550
Merge branch 'python' into walberla
jngrad Oct 28, 2022
e98c060
Merge remote-tracking branch 'jngrad/devops' into walberla
jngrad Oct 28, 2022
212f266
WIP: investigate PNFFT MPI error
jngrad Oct 28, 2022
5ab3bd7
Revert "WIP: investigate PNFFT MPI error"
jngrad Oct 28, 2022
a232e7f
EK: fixed heap-use-after-free
reinaual Nov 8, 2022
a70ea8c
Merge branch 'python' into walberla
jngrad Nov 25, 2022
f5cf45c
Formatting
jngrad Nov 25, 2022
dc9d6e3
test: Reduce EK test runtime in UBSAN/ASAN builds
reinaual Dec 5, 2022
fd46c4b
ekin: Separation of concerns
jngrad Dec 6, 2022
d281db4
lb: Fix Clang-Tidy 14 diagnostics
jngrad Dec 6, 2022
c8eeb5f
CMake: Disable Clang-Tidy on FetchContent projects
jngrad Dec 6, 2022
24a28b1
tests: Fix UBSAN/ASAN errors
jngrad Dec 6, 2022
dcd0226
Merge branch 'python' into walberla
jngrad Dec 6, 2022
c83969b
Fix regressions
jngrad Dec 6, 2022
fba8be6
CMake: Bump CUDA standard
jngrad Dec 6, 2022
48a1ee4
CMake: Silence C++20 warning from Cython
jngrad Dec 6, 2022
724429f
python: Fix regression
jngrad Dec 6, 2022
079338c
CI: Remove redundant jobs
jngrad Dec 6, 2022
d3afb76
CI: Fix build script
jngrad Dec 6, 2022
b3855ff
CI: Fix CMake flags
jngrad Dec 6, 2022
d67961c
CMake: Fix regression
jngrad Dec 6, 2022
eb915ad
core: Rename back CMake option
jngrad Dec 7, 2022
1145bf9
Run waLBerla in Clang with GPU support
jngrad Dec 12, 2022
465379e
waLBerla+cuda
jngrad Dec 13, 2022
10798ee
Fix CMake
jngrad Dec 13, 2022
12cd6e7
Fix CMake
jngrad Dec 13, 2022
3ac42e7
Fix CMake
jngrad Dec 13, 2022
13f903b
CMake: Disable Clang-Tidy on FetchContent projects
jngrad Dec 26, 2022
ae09a15
Merge commit '13f903b8d782cba8' into walberla
jngrad Dec 27, 2022
fb9b92b
CMake: Remove experimental filesystem
jngrad Dec 27, 2022
f2bbc54
CMake: Remove property from header-only targets
jngrad Dec 27, 2022
5e0025a
script_interface: LatticeWalberla: exposed read-only shape
reinaual Dec 12, 2022
f165226
ek: added and exposed unit conversion for boundary handlings
reinaual Dec 12, 2022
feb51a7
ek: units: permittivity
reinaual Jan 10, 2023
bc958e9
ek: units: reactions
reinaual Dec 12, 2022
9eb0841
ek: EKReactant: make order read-only to prevent breaking unit-conversion
reinaual Jan 13, 2023
32c0188
Merge branch 'python' into walberla
jngrad Jan 16, 2023
b0047ed
Merge remote-tracking branch 'reinaual/walberla_ek_unit_conversion' i…
jngrad Jan 16, 2023
1468e7f
walberla: Re-enable Ekin checkpointing
jngrad Jan 16, 2023
7f8d082
ek: added checkpointing
reinaual Jan 31, 2023
fd64c92
walberla: Remove code duplication
jngrad Feb 1, 2023
599aeed
Merge branch 'python' into walberla
jngrad Feb 1, 2023
4392eb5
Fix testsuite
jngrad Feb 1, 2023
b834ab7
Revert "Bump NB convert toolchain and improve testing"
jngrad Feb 1, 2023
ab383ff
Revert "Revert "Bump NB convert toolchain and improve testing""
jngrad Feb 3, 2023
c8aabf9
Check combination ScaFaCoS + waLBerla on Ubuntu 22.04
jngrad Feb 3, 2023
136797b
Revert "Check combination ScaFaCoS + waLBerla on Ubuntu 22.04"
jngrad Feb 3, 2023
2cfba8e
Revert "Revert "Check combination ScaFaCoS + waLBerla on Ubuntu 22.04""
jngrad Feb 3, 2023
801f620
Sort out LB tests
jngrad Feb 3, 2023
edab653
Sort out Cartesian communicator and checkpointing
jngrad Feb 3, 2023
2c82b00
Update copyright headers
jngrad Feb 3, 2023
e7ead8a
Remove addressed TODOs
jngrad Feb 3, 2023
2f8b775
Merge branch 'python' into walberla
jngrad Feb 3, 2023
693fef8
doc: electrokinetics: adapted tutorial code
reinaual Feb 13, 2023
d6d3719
testsuite: ek: removed old testcases
reinaual Feb 13, 2023
b964b99
maintainer: ek: fixed thermalization codegen
reinaual Feb 13, 2023
d36ee77
CMake: Remove MPI linker commands
jngrad Feb 24, 2023
accaaa1
walberla: Document how to prototype new methods
jngrad Feb 24, 2023
bad53b7
Merge branch 'python' into walberla
jngrad Feb 24, 2023
d4b5622
walberla: Re-enable tests on 4 MPI ranks
jngrad Feb 25, 2023
edff007
CMake: Fix broken patch command
jngrad Mar 2, 2023
885cb8e
CMake: Move AVX2 logic to dedicated file
jngrad Mar 2, 2023
8f2fcc3
Merge branch 'python' into walberla
jngrad Mar 2, 2023
7e9333b
CMake: Add workaround for patch command
jngrad Mar 2, 2023
0716013
Fix merge conflicts
jngrad Mar 2, 2023
afc0388
tests: Workaround for an OSError on Fedora
jngrad Mar 2, 2023
c78f967
Merge 'reinaual/walberla_ek_tutorial' into walberla
jngrad Mar 7, 2023
ef700df
Fixup ToC
jngrad Mar 7, 2023
825684b
Bump waLBerla version
jngrad Mar 8, 2023
640e252
CMake: Add missing CUDA flags
jngrad Mar 8, 2023
5538a2f
core: Modernize
jngrad Mar 8, 2023
f1a3837
renaming the viscocity to kinematic viscocity
capomav Mar 10, 2023
2630ca7
walberla: Various improvements
jngrad Mar 11, 2023
bbe80ed
Merge remote-tracking branch 'capomav/rename_viscosity' into walberla
jngrad Mar 11, 2023
33be058
Finish renaming kinematic viscosity
jngrad Mar 11, 2023
849a8a0
Merge branch 'python' into walberla
jngrad Mar 11, 2023
37cffb1
walberla: Bump CMake requirements
jngrad Mar 11, 2023
39c1079
Fix Clang warning
jngrad Mar 11, 2023
bafec14
CMake: Fixup
jngrad Mar 11, 2023
a8989eb
walberla: GPU accessors (WIP)
RudolfWeeber Mar 3, 2023
ca2c70f
maintainer: Modernize codegen scripts
jngrad Mar 6, 2023
624b9e4
walberla: Completely rewrite macroscopic accessors
jngrad Mar 14, 2023
3e04494
walberla: Regenerate all kernels with lbmpy 1.1.1
jngrad Mar 14, 2023
ea73ea1
Formatting
jngrad Mar 14, 2023
6751d63
Remove duplicated code
jngrad Mar 21, 2023
09bd007
Formatting
jngrad Mar 21, 2023
ca6a242
Merge remote-tracking branch 'upstream/python' into walberla
jngrad Mar 30, 2023
0c9f6cf
tests: Fix numpy deprecation warning
jngrad Apr 5, 2023
81f7360
Re-order setters and getters
jngrad Apr 3, 2023
5b05d15
script_interface: Implement LB slice via ranges
jngrad Apr 3, 2023
3bb6fa9
maintainer: Update comments
jngrad Apr 5, 2023
5265630
walberla: Implement new setters
jngrad Apr 5, 2023
d78f6eb
script_interface: Fix regression
jngrad Apr 5, 2023
5f74ec8
walberla: Split interface into headers and implementations
jngrad Apr 5, 2023
5dc521c
walberla: Remove legacy error handling mechanism
jngrad Apr 6, 2023
d29e860
walberla: Refactoring
jngrad Apr 7, 2023
6ed6dfa
walberla: Fix VTK parser
jngrad Apr 7, 2023
82f9487
walberla: Design a multi-piece VTK parser
jngrad Apr 13, 2023
44aa35e
walberla: Introduce units conversion for LB VTK
jngrad Apr 13, 2023
8ea0958
Merge branch 'python' into walberla
jngrad Apr 18, 2023
6d383e9
python: Move utility functions to subfolder
jngrad Apr 18, 2023
5bfd69e
walberla: Implement EKSlice
jngrad Apr 18, 2023
850db2d
script_interface: Factor out code duplication
jngrad Apr 19, 2023
e0a4205
doc: Fixup Sphinx
jngrad Apr 20, 2023
60f157f
Merge branch 'python' into walberla
jngrad Apr 24, 2023
be28e6b
walberla: Simplify VTK classes
jngrad Apr 24, 2023
f07ac42
walberla: Introduce units conversion for EK VTK
jngrad Apr 24, 2023
3d7553f
walberla: Fix ADL rule
jngrad Apr 24, 2023
08ea53a
test: Check EK VTK in parallel
jngrad Apr 25, 2023
da4c90a
walberla: Implement CellInterval-based slice setters/getters
jngrad Apr 25, 2023
20c7a37
walberla: Add modifiers and documentation
jngrad Apr 25, 2023
587d887
walberla: Fix assertions
jngrad Apr 25, 2023
7b925df
walberla: Disable FFT by default
jngrad Apr 26, 2023
2ac9f92
walberla: Cleanup
jngrad Apr 26, 2023
ea7a8f3
walberla: Rename class
jngrad Apr 26, 2023
6ecdc33
walberla: Update copyright year
jngrad Apr 26, 2023
be6c733
walberla: Fix -Wconversion in generated kernels
jngrad Apr 25, 2023
e847d71
walberla: Fix -Wconversion in the bridge
jngrad Apr 25, 2023
f290fc9
Merge branch 'python' into walberla
jngrad Apr 28, 2023
7803614
walberla: Rename electrokinetics module
jngrad Apr 26, 2023
5a394d2
wablerla: Big cleanup and fix some TODOs
jngrad Apr 28, 2023
ab050e0
CMake: Remove obsolete linker flags
jngrad May 1, 2023
1eae245
walberla: Address TODOs
jngrad May 1, 2023
7a08b17
walberla: Formatting
jngrad May 1, 2023
7334051
walberla: Restore deleted content
jngrad May 1, 2023
d19e5d4
DevOps: Fix CI
jngrad May 2, 2023
0e079aa
walberla: Cleanup EK tests
jngrad May 2, 2023
260eedc
DevOps: Use new ScaFaCoS image
jngrad May 2, 2023
851e466
walberla: Re-enable tutorials
jngrad May 2, 2023
c42b0c5
walberla: Regenerate kernels for pystencils/lbmpy 1.2
jngrad May 3, 2023
7ac020c
CMake: Remove custom compiler flags
jngrad May 3, 2023
4d82794
walberla: Bugfixes and test cases
jngrad May 3, 2023
e505b8b
walberla: Rename classes for consistency
jngrad May 3, 2023
9f3ffb5
walberla: Update copyright headers
jngrad May 3, 2023
8c30f15
walberla: Rewrite exception mechanism
jngrad May 3, 2023
4d5d9b7
walberla: More cleanup
jngrad May 3, 2023
66b9c6a
lees_edwards: Type conversion
jngrad May 4, 2023
1a870b0
walberla: Remove code duplication in VTK
jngrad May 4, 2023
a0a84e7
tests: Factor out code duplication
jngrad May 4, 2023
85c2a51
Merge remote-tracking branch 'jngrad/maintenance' into walberla
jngrad May 4, 2023
4192e19
walberla: More simplifications
jngrad May 4, 2023
a5135de
python: Simplify VTK
jngrad May 4, 2023
1a4608a
CMake: Fix regression
jngrad May 4, 2023
875b5da
walberla: Write extra EK unit tests
jngrad May 4, 2023
6610932
walberla: Move templates
jngrad May 4, 2023
7e948c9
walberla: More cleanup, more unit testing
jngrad May 4, 2023
688d61e
walberla: Document codegen
jngrad May 4, 2023
416db5c
CMake: Remove obsolete patch
jngrad May 4, 2023
0abc836
tests: Cleanup
jngrad May 5, 2023
e12323b
tests: Re-organize tests
jngrad May 5, 2023
dd6dbdf
walberla: Apply SOLID principles
jngrad May 8, 2023
8e4ed18
tests: Merge EK and LB VTK tests
jngrad May 8, 2023
cce7a46
walberla: Fix more regressions
jngrad May 8, 2023
427fffd
walberla: Rename VTK fields
jngrad May 8, 2023
8bd7b89
walberla: Restore all LB samples
jngrad May 8, 2023
c1d874b
walberla: More refactoring
jngrad May 8, 2023
a15d5fa
script_interface: Rewrite ObjectList as AutoParameters
jngrad May 9, 2023
48cd88d
script_interface: Rewrite ObjectList as AutoParameters
jngrad May 9, 2023
23a8ae8
walberla: Fix EK checkpointing
jngrad May 9, 2023
4cd1ad0
walberla: Add EKPoissonSolver checks
jngrad May 9, 2023
40a4a56
walberla: Add optional parameters
jngrad May 9, 2023
2d594b4
walberla: Simplify boundaries interface
jngrad May 9, 2023
ed97498
walberla: Add checks for solver tau
jngrad May 9, 2023
5cef536
walberla: Fix regressions
jngrad May 9, 2023
4a1534d
walberla: Fix race condition in MPI communicators
jngrad May 10, 2023
376d80b
walberla: Cleanup
jngrad May 10, 2023
5ab7ac2
script_interface: Rewrite ObjectMap as AutoParameters
jngrad May 11, 2023
b7b9006
Merge remote-tracking branch 'jngrad/object-list' into walberla
jngrad May 11, 2023
711f9d6
python: Reduce diff
jngrad May 11, 2023
0e2e7e3
walberla: Remove unused kernels
jngrad May 11, 2023
10924b2
walberla: Bump version
jngrad May 11, 2023
ea66e95
walberla: Update docs
jngrad May 11, 2023
34bde22
walberla: Adjust single-precision test tolerances
jngrad May 12, 2023
a0492b0
walberla: Coding style
jngrad May 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions maintainer/CI/build_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ fi
if $with_walberla; then
cmake_params="$cmake_params -DWITH_WALBERLA=ON"
fi
if [[ "$hide_gpu" == "true" ]]
then
echo Hiding gpu from Cuda via CUDA_VISIBLE_DEVICES
export CUDA_VISIBLE_DEVICES=
fi

if $insource; then
builddir=$srcdir
Expand Down
50 changes: 26 additions & 24 deletions src/core/grid_based_algorithms/LbWalberla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@

using namespace walberla;

inline Vector3d to_vector3d(const Vector3<real_t> v) {
return Vector3d{v[0], v[1], v[2]};
inline Utils::Vector3d to_vector3d(const Vector3<real_t> v) {
return Utils::Vector3d{v[0], v[1], v[2]};
}
Vector3<real_t> to_vector3(const Vector3d v) {
Vector3<real_t> to_vector3(const Utils::Vector3d v) {
return Vector3<real_t>{v[0], v[1], v[2]};
}

LbWalberla::LbWalberla(double viscosity, double agrid,
const Vector3d &box_dimensions,
const Vector3i &node_grid, double skin) {
const Utils::Vector3d &box_dimensions,
const Utils::Vector3i &node_grid, double skin) {

m_skin = skin;
m_agrid = agrid;

Vector3i grid_dimensions;
Utils::Vector3i grid_dimensions;
for (int i = 0; i < 3; i++) {
if (fmod(box_dimensions[i], agrid) >
std::numeric_limits<double>::epsilon()) {
Expand Down Expand Up @@ -149,7 +149,7 @@ void LbWalberla::print_vtk_density(char *filename) {
void LbWalberla::integrate() { m_time_loop->run(); }

boost::optional<LbWalberla::BlockAndCell>
LbWalberla::get_block_and_cell(const Vector3i &node) const {
LbWalberla::get_block_and_cell(const Utils::Vector3i &node) const {
// Get block and local cell
Cell global_cell{uint_c(node[0]), uint_c(node[1]), uint_c(node[2])};
auto block = m_blocks->getBlock(global_cell, 0);
Expand All @@ -163,8 +163,8 @@ LbWalberla::get_block_and_cell(const Vector3i &node) const {
return {{block, local_cell}};
}

bool LbWalberla::set_node_velocity_at_boundary(const Vector3i node,
const Vector3d v) {
bool LbWalberla::set_node_velocity_at_boundary(const Utils::Vector3i node,
const Utils::Vector3d v) {
auto bc = get_block_and_cell(node);
// Return if we don't have the cell.
if (!bc)
Expand All @@ -181,9 +181,9 @@ bool LbWalberla::set_node_velocity_at_boundary(const Vector3i node,
return true;
}

boost::optional<Vector3d>
LbWalberla::get_node_velocity_at_boundary(const Vector3i &node) const {
boost::optional<Vector3d> res;
boost::optional<Utils::Vector3d>
LbWalberla::get_node_velocity_at_boundary(const Utils::Vector3i &node) const {
boost::optional<Utils::Vector3d> res;
auto bc = get_block_and_cell(node);
// return if we don't have the cell
if (!bc)
Expand All @@ -196,14 +196,14 @@ LbWalberla::get_node_velocity_at_boundary(const Vector3i &node) const {
if (!boundary_handling->isBoundary((*bc).cell))
return res;

Vector3d v =
Utils::Vector3d v =
to_vector3d(boundary_handling->getBoundaryCondition<UBB_t>(uid).getValue(
(*bc).cell[0], (*bc).cell[1], (*bc).cell[2]));
res = {v};
return res;
}

bool LbWalberla::remove_node_from_boundary(const Vector3i &node) {
bool LbWalberla::remove_node_from_boundary(const Utils::Vector3i &node) {
auto bc = get_block_and_cell(node);
if (!bc)
return false;
Expand All @@ -215,7 +215,7 @@ bool LbWalberla::remove_node_from_boundary(const Vector3i &node) {
}

boost::optional<bool>
LbWalberla::get_node_is_boundary(const Vector3i &node) const {
LbWalberla::get_node_is_boundary(const Utils::Vector3i &node) const {
auto bc = get_block_and_cell(node);
if (!bc)
return {boost::none};
Expand Down Expand Up @@ -256,8 +256,8 @@ LbWalberla::create_fluid_field_vtk_writer(
return pdf_field_vtk_writer;
}

boost::optional<Vector3d>
LbWalberla::get_node_velocity(const Vector3i node) const {
boost::optional<Utils::Vector3d>
LbWalberla::get_node_velocity(const Utils::Vector3i node) const {
auto bc = get_block_and_cell(node);
if (!bc)
return {boost::none};
Expand All @@ -268,8 +268,8 @@ LbWalberla::get_node_velocity(const Vector3i node) const {
return {to_vector3d(vel_adaptor->get((*bc).cell))};
}

boost::optional<Vector3d>
LbWalberla::get_velocity_at_pos(const Vector3d &pos) const {
boost::optional<Utils::Vector3d>
LbWalberla::get_velocity_at_pos(const Utils::Vector3d &pos) const {
auto block = m_blocks->getBlock(to_vector3(pos));
if (!block)
return {boost::none};
Expand All @@ -281,7 +281,8 @@ LbWalberla::get_velocity_at_pos(const Vector3d &pos) const {
return {to_vector3d(v)};
}

bool LbWalberla::set_node_velocity(const Vector3i &node, const Vector3d v) {
bool LbWalberla::set_node_velocity(const Utils::Vector3i &node,
const Utils::Vector3d v) {
auto bc = get_block_and_cell(node);
if (!bc)
return false;
Expand All @@ -294,7 +295,8 @@ bool LbWalberla::set_node_velocity(const Vector3i &node, const Vector3d v) {
return true;
}

bool LbWalberla::set_node_density(const Vector3i node, const double density) {
bool LbWalberla::set_node_density(const Utils::Vector3i node,
const double density) {
auto bc = get_block_and_cell(node);
if (!bc)
return false;
Expand All @@ -311,7 +313,7 @@ bool LbWalberla::set_node_density(const Vector3i node, const double density) {
}

boost::optional<double>
LbWalberla::get_node_density(const Vector3i node) const {
LbWalberla::get_node_density(const Utils::Vector3i node) const {
auto bc = get_block_and_cell(node);
if (!bc)
return {boost::none};
Expand All @@ -329,13 +331,13 @@ void LbWalberla::set_viscosity(double viscosity) {
double LbWalberla::get_viscosity() {
return m_lattice_model->collisionModel().viscosity();
}
bool LbWalberla::node_in_local_domain(const Vector3i &node) const {
bool LbWalberla::node_in_local_domain(const Utils::Vector3i &node) const {
auto block = m_blocks->getBlock(
Cell{uint_c(node[0]), uint_c(node[1]), uint_c(node[2])}, 0);
return (block != nullptr);
}

bool LbWalberla::pos_in_local_domain(const Vector3d &pos) const {
bool LbWalberla::pos_in_local_domain(const Utils::Vector3d &pos) const {
auto block =
m_blocks->getBlock(real_c(pos[0]), real_c(pos[1]), real_c(pos[2]));
return (block != nullptr);
Expand Down
67 changes: 36 additions & 31 deletions src/core/grid_based_algorithms/LbWalberla.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#undef PI
#include "blockforest/StructuredBlockForest.h"
#include "boost/optional.hpp"
#include "boost/tuple/tuple.hpp"
#include "boundary/BoundaryHandling.h"
#include "core/mpi/Environment.h"
#include "field/FlagField.h"
Expand All @@ -30,7 +31,7 @@ const walberla::FlagUID UBB_flag("velocity bounce back");
class LbWalberla {
double m_skin;
double m_agrid;
Vector3d m_ext_force;
Utils::Vector3d m_ext_force;

// Type definitions
using vector_field_t =
Expand All @@ -43,10 +44,8 @@ class LbWalberla {
using Pdf_field_t = walberla::lbm::PdfField<Lattice_model_t>;

using UBB_t = walberla::lbm::UBB<Lattice_model_t, walberla::uint8_t>;
using Boundary_conditions_t = boost::tuples::tuple<UBB_t>;
using Boundary_handling_t =
walberla::BoundaryHandling<Flag_field_t, Lattice_model_t::Stencil,
Boundary_conditions_t>;
walberla::BoundaryHandling<Flag_field_t, Lattice_model_t::Stencil, UBB_t>;
class LB_boundary_handling {
public:
LB_boundary_handling(const walberla::BlockDataID &flag_field_id,
Expand All @@ -62,8 +61,7 @@ class LbWalberla {

return new Boundary_handling_t(
"boundary handling", flag_field, fluid,
boost::tuples::make_tuple(
UBB_t("velocity bounce back", UBB_flag, pdf_field, nullptr)));
UBB_t("velocity bounce back", UBB_flag, pdf_field, nullptr));
}

private:
Expand All @@ -77,50 +75,57 @@ class LbWalberla {
};

public:
LbWalberla(double viscosity, double agrid, const Vector3d &box_dimensions,
const Vector3i &node_grid, double skin);
LbWalberla(double viscosity, double agrid,
const Utils::Vector3d &box_dimensions,
const Utils::Vector3i &node_grid, double skin);

void integrate();
boost::optional<Vector3d> get_node_velocity(const Vector3i node) const;
bool set_node_velocity(const Vector3i &node, const Vector3d v);

bool add_force_at_pos(const Vector3d &position, const Vector3d &force);
boost::optional<Vector3d> get_velocity_at_pos(const Vector3d &position) const;
boost::optional<double> get_density_at_pos(const Vector3d &position);
// Vector3d get_stress_at_pos(const Vector3d& position);

boost::optional<double> get_node_density(const Vector3i node) const;
bool set_node_density(const Vector3i node, const double density);
boost::optional<Vector3d>
get_node_velocity_at_boundary(const Vector3i &node) const;
bool set_node_velocity_at_boundary(const Vector3i node, const Vector3d v);
bool remove_node_from_boundary(const Vector3i &node);
boost::optional<bool> get_node_is_boundary(const Vector3i &node) const;
boost::optional<Utils::Vector3d>
get_node_velocity(const Utils::Vector3i node) const;
bool set_node_velocity(const Utils::Vector3i &node, const Utils::Vector3d v);

bool add_force_at_pos(const Utils::Vector3d &position,
const Utils::Vector3d &force);
boost::optional<Utils::Vector3d>
get_velocity_at_pos(const Utils::Vector3d &position) const;
boost::optional<double> get_density_at_pos(const Utils::Vector3d &position);
// Utils::Vector3d get_stress_at_pos(const Utils::Vector3d& position);

boost::optional<double> get_node_density(const Utils::Vector3i node) const;
bool set_node_density(const Utils::Vector3i node, const double density);
boost::optional<Utils::Vector3d>
get_node_velocity_at_boundary(const Utils::Vector3i &node) const;
bool set_node_velocity_at_boundary(const Utils::Vector3i node,
const Utils::Vector3d v);
bool remove_node_from_boundary(const Utils::Vector3i &node);
boost::optional<bool> get_node_is_boundary(const Utils::Vector3i &node) const;

void print_vtk_velocity(char *filename);
void print_vtk_density(char *filename);
void print_vtk_boundary(char *filename);

void set_external_force(const Vector3d &ext_force) {
void set_external_force(const Utils::Vector3d &ext_force) {
m_ext_force = ext_force;
}
Vector3d get_external_force() { return m_ext_force; }
Utils::Vector3d get_external_force() { return m_ext_force; }

void set_viscosity(double viscosity);
double get_viscosity();

Vector3i get_grid_dimensions() {
return Vector3i{{int(m_blocks->getXSize()), int(m_blocks->getYSize()),
int(m_blocks->getZSize())}};
Utils::Vector3i get_grid_dimensions() {
return Utils::Vector3i{{int(m_blocks->getXSize()),
int(m_blocks->getYSize()),
int(m_blocks->getZSize())}};
};

double get_grid_spacing() { return m_agrid; }

bool node_in_local_domain(const Vector3i &node) const;
bool pos_in_local_domain(const Vector3d &pos) const;
bool node_in_local_domain(const Utils::Vector3i &node) const;
bool pos_in_local_domain(const Utils::Vector3d &pos) const;

private:
boost::optional<BlockAndCell> get_block_and_cell(const Vector3i &node) const;
boost::optional<BlockAndCell>
get_block_and_cell(const Utils::Vector3i &node) const;
walberla::BlockDataID m_pdf_field_id;
walberla::BlockDataID m_flag_field_id;
walberla::BlockDataID m_force_field_id;
Expand Down
57 changes: 8 additions & 49 deletions src/core/grid_based_algorithms/lb_interface.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#include "lb_interface.hpp"
#include "LbWalberla.hpp"
#include "communication.hpp"
#include "config.hpp"
#include "electrokinetics.hpp"
#include "global.hpp"
#include "grid.hpp"
#include "lb.hpp"
#include "lb_walberla_instance.hpp"
#include "lbgpu.hpp"

#include "utils/index.hpp"
Expand Down Expand Up @@ -174,7 +172,7 @@ void mpi_recv_fluid_populations(int node, int index, double *pop) {
} // namespace
#endif

#if defined(LB) || defined(LB_GPU) || defined(LB_WALBERLA)
#if defined(LB) || defined(LB_GPU)
void lb_lbfluid_update() {
if (lattice_switch == ActiveLB::CPU) {
#ifdef LB
Expand Down Expand Up @@ -210,55 +208,19 @@ void lb_lbfluid_propagate() {
}
}

/**
* @brief Check the boundary velocities.
* Sanity check if the velocity defined at LB boundaries is within the Mach
* number limits of the scheme i.e. u < 0.3.
*/
void lb_boundary_mach_check() {
// Boundary velocities are stored in MD units, therefore we need to scale them
// in order to get lattice units.
auto const conv_fac = lb_lbfluid_get_tau() / lb_lbfluid_get_agrid();
double constexpr mach_limit = 0.3;
using LBBoundaries::lbboundaries;
if (std::any_of(lbboundaries.begin(), lbboundaries.end(),
[conv_fac, mach_limit](auto const &b) {
return (b->velocity() * conv_fac).norm() >= mach_limit;
})) {
runtimeErrorMsg() << "Lattice velocity exceeds the Mach number limit";
}
}

/**
* @brief Perform LB parameter and boundary velocity checks.
*/
void lb_lbfluid_sanity_checks() {
if (lattice_switch == ActiveLB::GPU) {
#ifdef LB_GPU
if (this_node == 0) {
lb_GPU_sanity_checks();
lb_boundary_mach_check();
}
#endif
} else if (lattice_switch == ActiveLB::CPU) {
#ifdef LB
lb_sanity_checks();
lb_boundary_mach_check();
#endif
}
}

void lb_lbfluid_on_integration_start() {
lb_lbfluid_sanity_checks();
if (lattice_switch == ActiveLB::GPU) {
#ifdef LB_GPU
if (this_node == 0 and lb_reinit_particles_gpu()) {
lb_GPU_sanity_checks();
if (this_node == 0 && lb_reinit_particles_gpu()) {
lb_realloc_particles_gpu();
lb_reinit_particles_gpu.validate();
}
#endif
} else if (lattice_switch == ActiveLB::CPU) {
#ifdef LB
lb_sanity_checks();
jngrad marked this conversation as resolved.
Show resolved Hide resolved

halo_communication(&update_halo_comm,
reinterpret_cast<char *>(lbfluid[0].data()));
#endif
Expand Down Expand Up @@ -1283,9 +1245,8 @@ const Utils::Vector3d lb_lbnode_get_velocity(const Utils::Vector3i &ind) {
return {};
}

#if defined(LB) || defined(LB_GPU) // lbmodel not defined for LB_WALBERLA
const Vector6d lb_lbnode_get_pi(const Vector3i &ind) {
Vector6d p_pi = lb_lbnode_get_pi_neq(ind);
const Utils::Vector6d lb_lbnode_get_pi(const Utils::Vector3i &ind) {
Utils::Vector6d p_pi = lb_lbnode_get_pi_neq(ind);

// Add equilibrium stress to the diagonal (in LB units)
double const p0 = lb_lbfluid_get_density() * lbmodel.c_sound_sq;
Expand All @@ -1296,7 +1257,6 @@ const Vector6d lb_lbnode_get_pi(const Vector3i &ind) {

return p_pi;
}
#endif

const Utils::Vector6d lb_lbnode_get_pi_neq(const Utils::Vector3i &ind) {
Utils::Vector6d p_pi{};
Expand Down Expand Up @@ -1587,5 +1547,4 @@ Utils::Vector3d lb_lbfluid_calc_fluid_momentum() {
}
return fluid_momentum;
}

#endif // end of LB guard
#endif
Loading