Skip to content
Draft
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
322dbdc
usable fix to velocity BC for channel_regular
Jul 2, 2025
5910371
formatting change
Jul 2, 2025
b92df4a
formatting with llvm 20.1.7
Jul 3, 2025
4168c20
blocked unused variables
Jul 3, 2025
6c10113
removed commented code
Jul 3, 2025
79ecc99
fixed periodicity and n_cell
Jul 23, 2025
0b307e1
zero gradient outlet
Jul 23, 2025
34603d0
Merge branch 'main' into main
marchdf Jul 24, 2025
67d370e
build fix
marchdf Jul 24, 2025
ed73c99
default to something wrong so we know it's wrong
marchdf Jul 24, 2025
dc90053
white space
marchdf Jul 24, 2025
1527ff3
consolidate mach
marchdf Jul 24, 2025
2454387
remove um
marchdf Jul 24, 2025
453e7dc
consolidate input file
marchdf Jul 24, 2025
c20d35b
remove a couple other input options
marchdf Jul 24, 2025
4cad3ac
Merge branch 'NREL:main' into main
nileshsawant Aug 18, 2025
012f57f
Merge branch 'NREL:main' into main
nileshsawant Aug 21, 2025
38c935c
Merge branch 'NREL:main' into main
nileshsawant Aug 26, 2025
7eb0ddc
cylinder shedding case
Aug 26, 2025
59be659
corrected underline length
Aug 26, 2025
9d16e58
Merge branch 'NREL:main' into main
nileshsawant Sep 11, 2025
9e9d02f
Possible fix to AMR reflections. compute_q_corrections is needed befo…
Sep 11, 2025
e7fe638
turek amr input file
Sep 11, 2025
b7c8613
seperated amr turek into its own folder
Sep 24, 2025
adbd2b6
added tureks to tests
Sep 24, 2025
965ccac
tureks 2D tests only
Sep 24, 2025
b7541a9
test turek only in 3D
Sep 25, 2025
cdacebc
crashing even after bound checks
Oct 10, 2025
e0cd3b3
removed amr turek from tests
Oct 20, 2025
75c22e6
not checking q>=0 code quality test
Oct 20, 2025
b84e166
more codeQL fix
Oct 20, 2025
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
54 changes: 41 additions & 13 deletions Source/LBM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,13 +1019,41 @@
amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> fs = {0.0};
if ((is_fluid_arrs[nbx](iv, 1) == 1) &&
(mask_arrs[nbx](iv) == 0)) {

const auto f_arr = f_arrs[nbx];
const auto is_fluid_arr = is_fluid_arrs[nbx];

const auto& lb = amrex::lbound(f_arr);
const auto& ub = amrex::ubound(f_arr);
const amrex::Box fbox(
amrex::IntVect(AMREX_D_DECL(lb.x, lb.y, lb.z)),
amrex::IntVect(AMREX_D_DECL(ub.x, ub.y, ub.z)));

const auto& is_lb = amrex::lbound(is_fluid_arr);
const auto& is_ub = amrex::ubound(is_fluid_arr);
const amrex::Box is_box(
amrex::IntVect(AMREX_D_DECL(is_lb.x, is_lb.y, is_lb.z)),
amrex::IntVect(
AMREX_D_DECL(is_ub.x, is_ub.y, is_ub.z)));

for (int q = 0; q < constants::N_MICRO_STATES; q++) {
const auto& ev = evs[q];
const amrex::IntVect ivr(iv + evs[bounce_dirs[q]]);

for (int idir = 0; idir < AMREX_SPACEDIM; idir++) {
fs[idir] += 2.0 * ev[idir] * f_arrs[nbx](ivr, q) *
is_fluid_arrs[nbx](ivr, 0);
if (q >= 0 && q < constants::N_MICRO_STATES &&
bounce_dirs[q] >= 0 &&
bounce_dirs[q] < constants::N_MICRO_STATES) {

const auto& ev = evs[q];
const amrex::IntVect ivr(iv + evs[bounce_dirs[q]]);

// Bounds checking. Debug
if (fbox.contains(ivr) && is_box.contains(ivr)) {
for (int idir = 0; idir < AMREX_SPACEDIM;
idir++) {
fs[idir] += 2.0 * ev[idir] *
f_arrs[nbx](ivr, q) *
is_fluid_arrs[nbx](ivr, 0);
}
}
}
}
}
Expand Down Expand Up @@ -1135,11 +1163,11 @@

f_to_macrodata(lev);

compute_q_corrections(lev);

macrodata_to_equilibrium(lev);

compute_derived(lev);

compute_q_corrections(lev);
}

// Make a new level from scratch using provided BoxArray and
Expand Down Expand Up @@ -1191,11 +1219,11 @@

f_to_macrodata(lev);

compute_q_corrections(lev);

macrodata_to_equilibrium(lev);

compute_derived(lev);

compute_q_corrections(lev);
}

void LBM::initialize_f(const int lev)
Expand Down Expand Up @@ -1353,12 +1381,12 @@

f_to_macrodata(lev);

compute_q_corrections(lev);

macrodata_to_equilibrium(lev);

compute_derived(lev);

compute_q_corrections(lev);

m_ts_new[lev] = time;
m_ts_old[lev] = time - constants::SMALL_NUM;
}
Expand Down Expand Up @@ -1907,11 +1935,11 @@

f_to_macrodata(lev);

compute_q_corrections(lev);

macrodata_to_equilibrium(lev);

compute_derived(lev);

compute_q_corrections(lev);
}
}

Expand Down
2 changes: 2 additions & 0 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ if(MARBLES_DIM EQUAL 3)
add_test_r(single_cylinder)
add_test_r(channel_cylinder)
# add_test_r(channel_cylinder_amr)
add_test_r(cylinder_turek_2d2)
add_test_r(cylinder_turek_2d2_amr)
endif()

add_test_re(sod)
Expand Down
65 changes: 65 additions & 0 deletions Tests/test_files/cylinder_turek_2d2_amr/cylinder_turek_2d2_amr.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
max_step = 100000

# geometry parameters
geometry.prob_lo = 0.0 0.0 -2.0
geometry.prob_hi = 660.0 123.0 2.0
geometry.is_periodic = 0 0 1

# timestepping
amr.n_cell = 660 123 4
amr.max_level = 1
amr.max_grid_size = 32
amr.blocking_factor_x = 2
amr.blocking_factor_y = 1
amr.blocking_factor_z = 1
amr.plot_int = 100
amr.chk_int = 1000
amr.file_name_digits = 5

lbm.bc_lo = 2 1 0
lbm.bc_hi = 5 1 0
lbm.dx_outer = 1.0
lbm.dt_outer = 1.0

#nu = u D / Re
#nu = M a D / Re
#nu = M sqrt(gamma R T) D / Re
#nu = 0.1 sqrt(1.4 1 0.03333) 30 / 100

lbm.nu = 0.00648
lbm.alpha = 0.00648
lbm.initial_temperature = 0.03333
lbm.adiabatic_exponent = 1.4
lbm.save_streaming = 0
lbm.compute_forces = 1

lbm.velocity_bc_type = "parabolic"
velocity_bc_parabolic.Mach_ref = 0.1
velocity_bc_parabolic.normal_dir = 1
velocity_bc_parabolic.tangential_dir = 0
velocity_bc_parabolic.initial_density = 1.0
velocity_bc_parabolic.initial_temperature = 0.03333
velocity_bc_parabolic.adiabatic_exponent = 1.4

lbm.ic_type = "constant"
ic_constant.mach_components = 0.1 0.0 0.0
ic_constant.density = 1.0
ic_constant.initial_temperature = 0.03333
ic_constant.adiabatic_exponent = 1.4

eb2.geom_type = "cylinder"
eb2.cylinder_radius = 15.0
eb2.cylinder_center = 60.0 60.0 0.0
eb2.cylinder_has_fluid_inside = 0
eb2.cylinder_height = 1000.0
eb2.cylinder_direction = 2

tagging.refinement_indicators = box
tagging.box.in_box_lo = 30.0 30.0 -2.0
tagging.box.in_box_hi = 90.0 90.0 2.0

amrex.fpe_trap_invalid = 1
amrex.fpe_trap_zero = 1
amrex.fpe_trap_overflow = 1
amrex.the_arena_is_managed = 0
amrex.abort_on_out_of_gpu_memory = 1
Loading