From 4586ef79f742deb01f8c06e08b4c69b11007cf2c Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Thu, 9 Oct 2025 10:53:57 +0200 Subject: [PATCH] Solver: RubarBE: Fix study export and minor change. --- src/Solver/RubarBE.py | 74 +++++++++++++++++++++--------------------- src/View/MainWindow.py | 2 +- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Solver/RubarBE.py b/src/Solver/RubarBE.py index 5e934f9a..41e9d666 100644 --- a/src/Solver/RubarBE.py +++ b/src/Solver/RubarBE.py @@ -52,8 +52,8 @@ class Rubar3(CommandLineSolver): ("rubarbe_condav", "3"), ("rubarbe_regime", "0"), ("rubarbe_iodev", "n"), - ("rubarbe_iodebord", ""), - ("rubarbe_iostockage", ""), + # ("rubarbe_iodebord", ""), + # ("rubarbe_iostockage", ""), ("rubarbe_iopdt", "y"), ("rubarbe_iovis", "n"), ("rubarbe_rep", "n"), @@ -79,30 +79,30 @@ class Rubar3(CommandLineSolver): # ("rubarbe_dm", "0.1"), # ("rubarbe_segma", "1.0"), # Sediment parameters - ("rubarbe_sediment_ros", "2650.0"), - ("rubarbe_sediment_por", "0.4"), - ("rubarbe_sediment_dcharg", "0.0"), - ("rubarbe_sediment_halfa", "1.0"), - ("rubarbe_sediment_mult_1", "1.0"), - ("rubarbe_sediment_mult_2", ""), - ("rubarbe_sediment_mult_3", ""), - ("rubarbe_sediment_mult_4", ""), - ("rubarbe_sediment_mult_5", ""), - ("rubarbe_sediment_visc", "0.047"), - ("rubarbe_sediment_opts", "6"), - ("rubarbe_sediment_odchar", "0"), - ("rubarbe_sediment_unisol", "1"), - ("rubarbe_sediment_typdef", "3"), - ("rubarbe_sediment_depot", "2"), - ("rubarbe_sediment_choixc", "2"), - ("rubarbe_sediment_option", "2"), - ("rubarbe_sediment_capsol", "1"), - ("rubarbe_sediment_bmiu", "0.85"), - ("rubarbe_sediment_demix", "0"), - ("rubarbe_sediment_defond", "1"), - ("rubarbe_sediment_varcons", "1"), - ("rubarbe_sediment_dchard", "0.0"), - ("rubarbe_sediment_dchars", "0.0"), + # ("rubarbe_sediment_ros", "2650.0"), + # ("rubarbe_sediment_por", "0.4"), + # ("rubarbe_sediment_dcharg", "0.0"), + # ("rubarbe_sediment_halfa", "1.0"), + # ("rubarbe_sediment_mult_1", "1.0"), + # ("rubarbe_sediment_mult_2", ""), + # ("rubarbe_sediment_mult_3", ""), + # ("rubarbe_sediment_mult_4", ""), + # ("rubarbe_sediment_mult_5", ""), + # ("rubarbe_sediment_visc", "0.047"), + # ("rubarbe_sediment_opts", "6"), + # ("rubarbe_sediment_odchar", "0"), + # ("rubarbe_sediment_unisol", "1"), + # ("rubarbe_sediment_typdef", "3"), + # ("rubarbe_sediment_depot", "2"), + # ("rubarbe_sediment_choixc", "2"), + # ("rubarbe_sediment_option", "2"), + # ("rubarbe_sediment_capsol", "1"), + # ("rubarbe_sediment_bmiu", "0.85"), + # ("rubarbe_sediment_demix", "0"), + # ("rubarbe_sediment_defond", "1"), + # ("rubarbe_sediment_varcons", "1"), + # ("rubarbe_sediment_dchard", "0.0"), + # ("rubarbe_sediment_dchars", "0.0"), ] return lst @@ -129,7 +129,7 @@ class Rubar3(CommandLineSolver): def output_param(self): name = self._study.name - return f"hydlim.{name}" + return f"profil.{name}" def log_file(self): name = self._study.name @@ -148,7 +148,7 @@ class Rubar3(CommandLineSolver): self._export_stricklers(study, repertory, qlog, name=name) self._export_hydro(study, repertory, qlog, name=name) self._export_condav(study, repertory, qlog, name=name) - self._export_abshyd(study, repertory, qlog, name=name) + # self._export_abshyd(study, repertory, qlog, name=name) return True @@ -198,7 +198,7 @@ class Rubar3(CommandLineSolver): v2 = next(it).value v3 = next(it).value - f.write(f"{v2}{v3}") + # f.write(f"{v2}{v3}") # New line f.write(f"\n") @@ -332,7 +332,7 @@ class Rubar3(CommandLineSolver): if ind % 3 != 0: f.write("\n") - def _export_devers(self, study, repertory, qlog, name="0"): + def _export_abshyd(self, study, repertory, qlog, name="0"): if qlog is not None: qlog.put("Export ABSHYD file") @@ -354,7 +354,7 @@ class Rubar3(CommandLineSolver): reach_ind += 1 - def _export_abshyd(self, study, repertory, qlog, name="0"): + def _export_devers(self, study, repertory, qlog, name="0"): if qlog is not None: qlog.put("Export DEVERS file") @@ -428,9 +428,8 @@ class Rubar3(CommandLineSolver): ) as f: for edge in study.river.enable_edges(): reach = edge.reach - lm = len(reach) + 1 - f.write(f"{0.0:>6.4f} {lm:>6}\n") + f.write(f"{0.0}\n") ics = study.river.initial_conditions.get(edge) data = self._export_condin_init_data(ics) @@ -439,7 +438,8 @@ class Rubar3(CommandLineSolver): first = profiles[0] last = profiles[-1] - if first.rk not in data or last.rk not in data: + if first not in data or last not in data: + print(data) logger.error( "Study initial condition is not fully defined" ) @@ -457,7 +457,7 @@ class Rubar3(CommandLineSolver): prev_h, prev_s = f_h_s for profile in it: - if profile.rk not in data: + if profile not in data: ind += 1 continue @@ -489,8 +489,8 @@ class Rubar3(CommandLineSolver): return data def _export_condin_profile_height_speed(self, profile, data): - z = data[profile.rk][0] - q = data[profile.rk][1] + z = data[profile][0] + q = data[profile][1] height = z - profile.z_min() speed = profile.speed(q, z) diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index c04dd7c4..2972e3ce 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -608,7 +608,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): self._last_solver = solver self.last_results = results - self._study.status.set_as_not_saved() + self._study.status._set_as_not_saved() self.enable_actions("action_menu_results_last", True) ############