Skip to content

Commit 271b734

Browse files
committed
merge
Merge branch 'master' of github.com:comp-physics/Carleman-QLBM
2 parents 37c000f + a5c5329 commit 271b734

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/CLBM/CLBM_collision_test.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ include(QCFD_SRC * "LBM/f_initial.jl")
77

88
function CLBM_collision_test(Q, omega, f, C, truncation_order, dt, tau_value, e_value, n_time, l_plot)
99
#---arbitrary initial condition
10-
println("Single point CLBM collision test of the Forets and Pouly Carleman linearization")
10+
if ngrid == 1
11+
println("Single point CLBM collision test of the Forets and Pouly Carleman linearization")
12+
else
13+
println("Multi-grid CLBM collision test ($ngrid grid points) of the Forets and Pouly Carleman linearization")
14+
end
1115
u0 = 0.1
1216
f_ini = f_ini_test(u0)
1317

@@ -27,7 +31,11 @@ end
2731

2832
function CLBM_collision_test_sparse(Q, omega, f, truncation_order, dt, tau_value, e_value, n_time, l_plot)
2933
#---arbitrary initial condition for sparse version
30-
println("Single point CLBM collision test using SPARSE Carleman matrix implementation")
34+
if ngrid == 1
35+
println("Single point CLBM collision test using SPARSE Carleman matrix implementation")
36+
else
37+
println("Multi-grid CLBM collision test ($ngrid grid points) using SPARSE Carleman matrix implementation")
38+
end
3139
u0 = 0.1
3240
f_ini = f_ini_test(u0)
3341

src/CLBM/clbm_config.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Global simulation parameters
55
global tau_value = 1.0
6-
global n_time = 10
6+
global n_time = 100
77
global dt = tau_value / 10
88

99
# Domain parameters
@@ -17,7 +17,7 @@ global ngrid = 2
1717
# Sparse matrix computation control
1818
# true: Use sparse matrices (recommended for ngrid > 1)
1919
# false: Use dense matrices (only feasible for small problems)
20-
global use_sparse = false # Testing dense mode
20+
global use_sparse = true # Testing dense mode
2121

2222
# Helper function to get recommended sparse setting
2323
function get_recommended_sparse_setting(ngrid_val)

src/CLBM/clbm_run.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ if use_sparse
5454
else
5555
println("Using DENSE Carleman matrix implementation (use_sparse=$use_sparse, ngrid=$ngrid)")
5656
C, bt, F0 = carleman_C(Q, truncation_order, poly_order, f, omega, tau_value, force_factor, w_value, e_value)
57-
V = carleman_V(f, truncation_order)
5857
fT, VT_f, VT = CLBM_collision_test(Q, omega, f, C, truncation_order, dt, tau_value, e_value, n_time, l_plot)
5958
end
6059

6160
title("CLBM-D1Q3, " * L"\tau=" *string(tau_value) * L", u_0 = 0.1")
6261

62+
# Ensure the plot is displayed
63+
show()
64+
6365
lsavef = false
6466

6567
if lsavef

src/CLBM/timeMarching.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function carleman_C_sparse(Q, truncation_order, poly_order, f, omega, tau_value,
4949
bt = spzeros(C_dim)
5050
bt[1:Q] = F0
5151

52-
# FIXED: Build sparse matrix with same overwrite behavior as dense version
5352
# Use a temporary dense matrix to handle overlaps correctly, then convert to sparse
5453
C_temp = zeros(C_dim, C_dim)
5554

@@ -62,7 +61,6 @@ function carleman_C_sparse(Q, truncation_order, poly_order, f, omega, tau_value,
6261
# Get the block matrix using sparse operations
6362
A_block_sparse = carleman_transferA_sparse(ind_row, ind_col, Q, f, omega, tau_value, force_factor, w_value, e_value, F0, ngrid)
6463

65-
# FIXED: Use overwrite assignment (same as dense version)
6664
# This ensures later blocks overwrite earlier blocks in overlapping regions
6765
C_temp[ind_row_C, ind_col_C] = Array(A_block_sparse)
6866
end

0 commit comments

Comments
 (0)