Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
bc54169
fixup! syntax formating with clang and costexpr allcaps
uschille Apr 16, 2026
43b3849
Feature/ci (#1)
abhinsuresh May 12, 2026
abb1732
adding small changes to src/version.h to see PR failing (#2)
abhinsuresh May 12, 2026
349ce25
adding ctest for checking lb_multicomponent test (#3)
abhinsuresh May 12, 2026
850ff07
lbmulticomponnent unit test working executable added
abhinsuresh Aug 24, 2026
2779941
moved basic unit/smoke test from force-style to folder latboltz
abhinsuresh Aug 25, 2026
323fbab
changed the ci for latboltz to the new one
abhinsuresh Aug 25, 2026
4dadbbb
basic code of generating and reading yaml file added to the current s…
abhinsuresh Aug 26, 2026
09c519d
moved the lb test from local main to the main in force-styles
abhinsuresh Aug 27, 2026
2dc491c
added a global function to calculate total momentum to use in testing
abhinsuresh Aug 31, 2026
2d671f4
linked the simple test to run in gtest
abhinsuresh Aug 31, 2026
e48062f
added some cout options and make test run with 2 mpi ranks
abhinsuresh Sep 1, 2026
823143d
added condition to check pkg before compiling and adding test
abhinsuresh Sep 1, 2026
f592b9b
bringing changes from latest branch and updating CI
abhinsuresh Sep 2, 2026
a307555
limting build to 4 parallel jobs
abhinsuresh Sep 2, 2026
af725d6
added conservation of fictitious mass
abhinsuresh Sep 3, 2026
b44c96d
adding small change in init droplet
abhinsuresh Sep 7, 2026
d72fd28
adding unit test on moments and calc_gradients
abhinsuresh Sep 23, 2026
541698c
giving more structure to the test
abhinsuresh Oct 6, 2026
26dd6a9
addding gradient testing using TEST_P
abhinsuresh Oct 8, 2026
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
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: ctest CI

on:
pull_request:
branches:
- ternary-lbm

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get install -y openmpi-bin libopenmpi-dev

- name: Configure with tests
run: |
cmake -S cmake -B build -D BUILD_MPI=yes \
-D PKG_LATBOLTZ=yes \
-D ENABLE_TESTING=yes

- name: Build
run: |
cmake --build build -j4

- name: Run tests
run: ctest --test-dir build -R 'FixLBMulticomponent:plain' --output-on-failure
41 changes: 41 additions & 0 deletions src/LATBOLTZ/fix_lb_multicomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,47 @@ void FixLbMulticomponent::end_of_step()
dump_xdmf(update->ntimestep);
}

void FixLbMulticomponent::get_total_momentum(double &jx, double &jy, double &jz)
{
double local[3] = {0.0, 0.0, 0.0};
double global[3] = {0.0, 0.0, 0.0};

for (int x = halo_extent[0]; x < subNbx - halo_extent[0]; ++x)
for (int y = halo_extent[1]; y < subNby - halo_extent[1]; ++y)
for (int z = halo_extent[2]; z < subNbz - halo_extent[2]; ++z)
for(int i = 0; i < numvel; ++i){
local[0] += f_lb[x][y][z][i] * e19[i][0];
local[1] += f_lb[x][y][z][i] * e19[i][1];
local[2] += f_lb[x][y][z][i] * e19[i][2];
}

MPI_Reduce(local, global, 3, MPI_DOUBLE, MPI_SUM, 0, world);

if (me == 0){
jx = global[0];
jy = global[1];
jz = global[2];
}
}

void FixLbMulticomponent::get_total_mass(double &m)
{
double local = 0.0;
double global = 0.0;

for (int x = halo_extent[0]; x < subNbx - halo_extent[0]; ++x)
for (int y = halo_extent[1]; y < subNby - halo_extent[1]; ++y)
for (int z = halo_extent[2]; z < subNbz - halo_extent[2]; ++z)
for(int i = 0; i < numvel; ++i){
local += f_lb[x][y][z][i];
}

MPI_Reduce(&local, &global, 1, MPI_DOUBLE, MPI_SUM, 0, world);

if (me == 0)
m = global;
}

void FixLbMulticomponent::lb_update()
{

Expand Down
4 changes: 4 additions & 0 deletions src/LATBOLTZ/fix_lb_multicomponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ class FixLbMulticomponent : public FixLbFluid {
int setmask() override;
void initial_integrate(int) override;
void end_of_step() override;
void get_total_momentum(double &, double &, double &);
void get_total_mass(double &);

private:
friend class FixLbMulticomponentTestAccess;

double tau_r, tau_p, tau_s;
double gamma_p, gamma_s;
double kappa1, kappa2, kappa3;
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define LAMMPS_VERSION "27 Dec 2024"
#define LAMMPS_UPDATE "Development @ 4a3bfb5"
#define LAMMPS_UPDATE "Update 10"
1 change: 1 addition & 0 deletions unittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ add_subdirectory(fortran)
add_subdirectory(python)
add_subdirectory(tools)
add_subdirectory(force-styles)
add_subdirectory(latboltz)

# clang-format support for test sources

Expand Down
34 changes: 34 additions & 0 deletions unittest/latboltz/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
set(FORCE_STYLE_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../force-styles)
set(TEST_INPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/tests)

if (PKG_LATBOLTZ AND BUILD_MPI)
#test for lattice boltzman multicomponent
add_executable(test_fix_lb_multicomponent test_fix_lb_multicomponent.cpp)

if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(test_fix_lb_multicomponent PRIVATE USING_STATIC_LIBS=1)
endif()

target_include_directories(test_fix_lb_multicomponent PRIVATE ${FORCE_STYLE_TEST_DIR}
${LAMMPS_SOURCE_DIR}/LATBOLTZ)

target_link_libraries(test_fix_lb_multicomponent PRIVATE style_tests)

file(GLOB LB_FLUID_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/test_lb_multicomponent*.yaml)
foreach(TEST ${LB_FLUID_TESTS})
add_mpi_test(NAME FixLBMulticomponent:plain NUM_PROCS 2 COMMAND
$<TARGET_FILE:test_fix_lb_multicomponent> ${TEST}
--gtest_filter=FixLBMulticomponent.plain)
add_mpi_test(NAME FixLBMulticomponent:moments NUM_PROCS 1 COMMAND
$<TARGET_FILE:test_fix_lb_multicomponent> ${TEST}
--gtest_filter=FixLbMulticomponentTest.*)
add_mpi_test(NAME FixLBMulticomponent:derivatives NUM_PROCS 1 COMMAND
$<TARGET_FILE:test_fix_lb_multicomponent> ${TEST}
--gtest_filter=FixLbDerivativeTest.*:*/FixLbDerivativePolynomialTest.*)
set_tests_properties(FixLBMulticomponent:plain PROPERTIES PROCESSORS 2 TIMEOUT 120)
set_tests_properties(FixLBMulticomponent:moments PROPERTIES PROCESSORS 1 TIMEOUT 30)
set_tests_properties(FixLBMulticomponent:derivatives PROPERTIES PROCESSORS 1 TIMEOUT 30)
endforeach()
endif()
#set_tests_properties(FixLBMulticomponent:plain PROPERTIES
# PASS_REGULAR_EXPRESSION "Total wall time")
Loading
Loading