keep previons settings in generate BC dialog

compare_results
Theophile Terraz 2024-09-19 10:44:19 +02:00
parent 3814f9a1c9
commit 0b78522ca5
1 changed files with 8 additions and 4 deletions

View File

@ -133,6 +133,7 @@ class EditBoundaryConditionWindow(PamhyrWindow):
self.setup_plot() self.setup_plot()
self.setup_data() self.setup_data()
self.setup_connections() self.setup_connections()
self.setup_dialog()
def setup_data(self): def setup_data(self):
self._is_solid = self._data.bctype == "SL" self._is_solid = self._data.bctype == "SL"
@ -217,6 +218,10 @@ class EditBoundaryConditionWindow(PamhyrWindow):
self._d50sigma.d50Changed.connect(self.d50_changed) self._d50sigma.d50Changed.connect(self.d50_changed)
self._d50sigma.sigmaChanged.connect(self.sigma_changed) self._d50sigma.sigmaChanged.connect(self.sigma_changed)
def setup_dialog(self):
reach = self._data.reach(self._study.river)[0]
self.slope_value = abs(reach.get_incline_median_mean())
def d50_changed(self, value): def d50_changed(self, value):
self._undo_stack.push( self._undo_stack.push(
SetMetaDataCommand( SetMetaDataCommand(
@ -335,13 +340,12 @@ class EditBoundaryConditionWindow(PamhyrWindow):
return return
reach = self._data.reach(self._study.river)[0] reach = self._data.reach(self._study.river)[0]
profile = reach.profiles[-1] profile = reach.profiles[-1]
incline = abs(reach.get_incline_median_mean()) dlg = GenerateDialog(self.slope_value,
dlg = GenerateDialog(incline,
reach, reach,
trad=self._trad, trad=self._trad,
parent=self) parent=self)
if dlg.exec(): if dlg.exec():
incline = dlg.value self.slope_value = dlg.value
frictions = reach._parent.frictions.frictions frictions = reach._parent.frictions.frictions
z_min = profile.z_min() z_min = profile.z_min()
z_max = profile.z_max() z_max = profile.z_max()
@ -353,7 +357,7 @@ class EditBoundaryConditionWindow(PamhyrWindow):
strickler = 25.0 strickler = 25.0
height = [(i)*(z_max-z_min)/50 for i in range(51)] height = [(i)*(z_max-z_min)/50 for i in range(51)]
q = [((profile.wet_width(z_min + h) * 0.8) * strickler q = [((profile.wet_width(z_min + h) * 0.8) * strickler
* (h ** (5/3)) * (abs(incline) ** (0.5))) * (h ** (5/3)) * (abs(self.slope_value) ** (0.5)))
for h in height] for h in height]
for i in range(len(height)): for i in range(len(height)):
height[i] += z_min height[i] += z_min