Commit 4d2ba402 authored by Theophile Terraz's avatar Theophile Terraz
Browse files

work on get friction values from rk

Showing with 42 additions and 8 deletions
+42 -8
......@@ -373,13 +373,13 @@ class BoundaryCondition(SQLSubModel):
self._status.modified()
def reach(self, river):
edges = []
r = []
if self._node is not None:
if river is not None:
for edge in river.edges():
if edge.node1.name == self._node.name:
edges.append(edge.reach)
r.append(edge.reach)
if edge.node2.name == self._node.name:
edges.append(edge.reach)
r.append(edge.reach)
return edges
return r
......@@ -22,6 +22,8 @@ from tools import trace, timer
from Model.Tools.PamhyrDB import SQLSubModel
from numpy import interp
logger = logging.getLogger()
......@@ -241,3 +243,17 @@ class Friction(SQLSubModel):
def end_strickler(self, strickler):
self._end_strickler = strickler
self._status.modified()
def get_friction(self, rk):
if not self.contains_rk(rk):
return None
minor = interp(rk,
[self.begin_rk, self.end_rk],
[self.begin_strickler.minor,
self.end_strickler.minor])
medium = interp(rk,
[self.begin_rk, self.end_rk],
[self.begin_strickler.medium,
self.end_strickler.medium])
return minor, medium
......@@ -395,8 +395,14 @@ class InitialConditions(SQLSubModel):
logger.debug(f"incline = {incline}")
self._data = []
for profile in profiles:
width = profile.width_approximation()
strickler = 25
width = profile.wet_width(profile.z_min() + height)
frictions = self._reach.frictions.frictions
strickler = None
for f in frictions:
if f.contains_rk(profile.rk):
strickler = f.get_friction(profile.rk)[0]
if strickler is None:
strickler = 25.0
if not compute_discharge:
discharge = data_discharge[profile.rk]
......@@ -449,7 +455,13 @@ class InitialConditions(SQLSubModel):
self._data = []
for profile in profiles:
width = profile.width_approximation()
strickler = 25
frictions = self._reach.frictions.frictions
strickler = None
for f in frictions:
if f.contains_rk(profile.rk):
strickler = f.get_friction(profile.rk)[0]
if strickler is None:
strickler = 25.0
if not compute_height:
height = data_height[profile.rk]
......
......@@ -333,9 +333,15 @@ class EditBoundaryConditionWindow(PamhyrWindow):
reach = self._data.reach(self._study.river)[0]
profile = reach.profiles[-1]
incline = reach.get_incline_median_mean()
frictions = reach._parent.frictions.frictions
z_min = profile.z_min()
z_max = profile.z_max()
strickler = 25
strickler = None
for f in frictions:
if f.contains_rk(profile.rk):
strickler = f.get_friction(profile.rk)[0]
if strickler is None:
strickler = 25.0
height = [(i)*(z_max-z_min)/50 for i in range(51)]
q = [((profile.wet_width(z_min + h) * 0.8) * strickler
* (h ** (5/3)) * (abs(incline) ** (0.5)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment