harishaseebat92 commited on
Commit
8a70ec2
·
1 Parent(s): 94cce95

qlbm: Initial distribution edges, Progress logging

Browse files
Files changed (2) hide show
  1. fluid3d_pyvista.py +6 -2
  2. qlbm.py +12 -2
fluid3d_pyvista.py CHANGED
@@ -652,7 +652,8 @@ def simulate_qlbm_3D_and_animate(num_reg_qubits: int, T: int, distribution_type:
652
 
653
  data_frames = []
654
  actual_timesteps = []
655
- for t in time_steps:
 
656
  file_path = intermediate_folder_path / f"{t}_{rank}.npy"
657
  if file_path.exists():
658
  sol_loaded = np.load(file_path)
@@ -660,7 +661,10 @@ def simulate_qlbm_3D_and_animate(num_reg_qubits: int, T: int, distribution_type:
660
  data = np.reshape(sol_loaded, (downsampled_N, downsampled_N, downsampled_N))
661
  data_frames.append(data)
662
  actual_timesteps.append(t)
663
- print(f"Time {t}: Min={np.min(data)}, Max={np.max(data)}, Mean={np.mean(data)}")
 
 
 
664
  else:
665
  print(f"Warning: File {file_path} size {sol_loaded.size} != expected {downsampled_N*downsampled_N*downsampled_N}. Skipping.")
666
  else:
 
652
 
653
  data_frames = []
654
  actual_timesteps = []
655
+ total_frames = len(time_steps) if time_steps else 0
656
+ for idx, t in enumerate(time_steps):
657
  file_path = intermediate_folder_path / f"{t}_{rank}.npy"
658
  if file_path.exists():
659
  sol_loaded = np.load(file_path)
 
661
  data = np.reshape(sol_loaded, (downsampled_N, downsampled_N, downsampled_N))
662
  data_frames.append(data)
663
  actual_timesteps.append(t)
664
+ if total_frames:
665
+ progress = int(((idx + 1) / total_frames) * 100)
666
+ print(f"Loading frames: {progress}% complete (t = {t})")
667
+
668
  else:
669
  print(f"Warning: File {file_path} size {sol_loaded.size} != expected {downsampled_N*downsampled_N*downsampled_N}. Skipping.")
670
  else:
qlbm.py CHANGED
@@ -118,7 +118,7 @@ state.update({
118
  "dist_type": None,
119
  "nx_slider_index": 2, # Default to 32
120
  "nx": 32,
121
- "show_edges": True,
122
  "custom_dist_params": False,
123
  "sine_k_x": 1.0,
124
  "sine_k_y": 1.0,
@@ -879,6 +879,7 @@ def reset_simulation():
879
  state.run_error = ""
880
  state.simulation_has_run = False
881
  state.dist_type = None
 
882
  state.problems_selection = None
883
  state.geometry_selection = None
884
  state.backend_type = None
@@ -950,7 +951,16 @@ def _on_problem_selection_change(problems_selection, **_):
950
  finally:
951
  _apply_workflow_highlights(_determine_workflow_step())
952
 
953
- @state.change("dist_type", "show_edges", "sine_k_x", "sine_k_y", "sine_k_z", "gauss_cx", "gauss_cy", "gauss_cz", "gauss_sigma")
 
 
 
 
 
 
 
 
 
954
  def on_param_change(**kwargs):
955
  update_view()
956
  _apply_workflow_highlights(_determine_workflow_step())
 
118
  "dist_type": None,
119
  "nx_slider_index": 2, # Default to 32
120
  "nx": 32,
121
+ "show_edges": False,
122
  "custom_dist_params": False,
123
  "sine_k_x": 1.0,
124
  "sine_k_y": 1.0,
 
879
  state.run_error = ""
880
  state.simulation_has_run = False
881
  state.dist_type = None
882
+ state.show_edges = False
883
  state.problems_selection = None
884
  state.geometry_selection = None
885
  state.backend_type = None
 
951
  finally:
952
  _apply_workflow_highlights(_determine_workflow_step())
953
 
954
+ @state.change("dist_type")
955
+ def _on_dist_type_change(dist_type, **_):
956
+ # Whenever the user picks a new excitation, hide edges until they touch the slider again
957
+ if state.show_edges:
958
+ state.show_edges = False
959
+ update_view()
960
+ _apply_workflow_highlights(_determine_workflow_step())
961
+
962
+
963
+ @state.change("show_edges", "sine_k_x", "sine_k_y", "sine_k_z", "gauss_cx", "gauss_cy", "gauss_cz", "gauss_sigma")
964
  def on_param_change(**kwargs):
965
  update_view()
966
  _apply_workflow_highlights(_determine_workflow_step())