Skip to content

Commit 9265845

Browse files
modified: source/io_data_process.py source/solifluction.py source/vof.py
number of layers calculation is revised to avoid a layer with zero thikness at surface, rhs is set not to be negative
1 parent 674d642 commit 9265845

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

source/io_data_process.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,9 @@ def initiate_layers_variables(
356356
print("initiate_initial_layers_variables is in run")
357357

358358
num_layers: int = int(
359-
np.ceil(max_h_total - bed_depth_elevation) / h_mesh_step_value + 1
359+
np.ceil(max_h_total - bed_depth_elevation)
360+
/ h_mesh_step_value
361+
# np.ceil(max_h_total - bed_depth_elevation) / h_mesh_step_value + 1
360362
)
361363

362364
h_total_initial = lfr.from_gdal(

source/solifluction.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ def solifluction_simulate(
340340

341341
print("local_heat_transfer_iteration :", local_heat_transfer_iteration)
342342

343-
# --------------- End: compute temperatures in internal layers -------------------------
343+
# --------------- End: compute temperatures in internal layers -----------------
344344

345-
# --------------- compute momentum u_x in internal layers ------------------------------
345+
# --------------- compute momentum u_x in internal layers ----------------------
346346

347347
for local_momentum_iteration in range(1, momentum_iteration_threshold + 1):
348348
# while (
@@ -370,6 +370,13 @@ def solifluction_simulate(
370370
)
371371
)
372372

373+
# NOTE: rhs cannot be negative as the flow cannot be to the upstream
374+
rhs = lfr.where(
375+
(rhs > 0),
376+
rhs,
377+
0,
378+
)
379+
373380
# print("type of layer_list[layer_id].T:", type(layer_list[layer_id].T))
374381

375382
phase_state = phase_detect_from_temperature(layer_list[layer_id].T)
@@ -518,6 +525,16 @@ def solifluction_simulate(
518525
layer_id,
519526
)
520527

528+
for layer_id in range(0, num_layers):
529+
530+
layer_h_mesh_numpy = lfr.to_numpy(layer_list[layer_id].h_mesh)
531+
print(
532+
"layer_h_mesh_numpy[10,10]",
533+
layer_h_mesh_numpy[10, 10],
534+
"layer_id",
535+
layer_id,
536+
)
537+
521538
# local_momentum_time = local_momentum_time + dt_momentum
522539
# local_momentum_iteration = local_momentum_iteration + 1
523540

@@ -529,10 +546,10 @@ def solifluction_simulate(
529546
# time - (momentum_iteration_threshold * dt_momentum)
530547
# ) + dt_mass_conservation
531548

532-
print("time inside momentum u_x", time)
533-
# input("enter to continue ...")
549+
print("time inside momentum u_x", time)
550+
input("enter to continue ...")
534551

535-
# --------------- End: compute momentum u_x in internal layers -------------------------------
552+
# --------------- End: compute momentum u_x in internal layers -----------------
536553

537554
# --------------- compute VOF -------------------------------
538555

source/vof.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ def h_mesh_assign(
268268
h_total: Any, num_layers: Any, prespecified_uniform_h_mesh_value: float
269269
) -> list[Any]:
270270

271+
epsilon = 1e-5
272+
271273
h_total_remain = h_total
272274
h_mesh_list = []
273275

@@ -287,6 +289,7 @@ def h_mesh_assign(
287289
h_total_remain,
288290
prespecified_uniform_h_mesh_value,
289291
)
292+
h_mesh = lfr.where(h_mesh < epsilon, 0.0, h_mesh)
290293
h_mesh_list.append(h_mesh)
291294

292295
h_total_remain = h_total_remain - prespecified_uniform_h_mesh_value

0 commit comments

Comments
 (0)