work on get friction values from rk

This commit is contained in:
Theophile Terraz committed 2024-08-08 12:03:25 +02:00
1 parent 845bf3c325
commit 4d2ba40287
4 files changed
+42 -8

No files matched your search

@@ -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
+16
View File
@@ -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]