mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-29 19:10:42 +01:00
RubarBE: notify when attempting to use RubarBE with solid boundary conditions missing
This commit is contained in:
1 parent
ed2ed0ac2a
commit
656b337499
2 files changed
+36
-1
No files matched your search
+29
-1
@@ -153,8 +153,22 @@ class Rubar3(CommandLineSolver):
|
|||||||
qlog.put(trad["warning"].format(message=message))
|
qlog.put(trad["warning"].format(message=message))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
trased = self._parameter_flag(study, "trased") == "O"
|
||||||
|
if trased:
|
||||||
|
# Notice §3.6: HYDROS is required at each upstream boundary
|
||||||
|
missing = self._reaches_without_solid_boundary(study)
|
||||||
|
if missing:
|
||||||
|
trad = RunSolverTranslate()
|
||||||
|
message = trad["missing_solid_boundary"].format(
|
||||||
|
reaches=", ".join(missing)
|
||||||
|
)
|
||||||
|
logger.warning(message)
|
||||||
|
if qlog is not None:
|
||||||
|
qlog.put(trad["warning"].format(message=message))
|
||||||
|
return False
|
||||||
|
|
||||||
self._export_donnee(study, repertory, qlog, name=name)
|
self._export_donnee(study, repertory, qlog, name=name)
|
||||||
if self._parameter_flag(study, "trased") == "O":
|
if trased:
|
||||||
if not self._export_ts(study, repertory, qlog, name=name):
|
if not self._export_ts(study, repertory, qlog, name=name):
|
||||||
return False
|
return False
|
||||||
self._export_geomac_i(study, repertory, qlog, name=name)
|
self._export_geomac_i(study, repertory, qlog, name=name)
|
||||||
@@ -194,6 +208,20 @@ class Rubar3(CommandLineSolver):
|
|||||||
("defond", "integer"), ("varcons", "integer"),
|
("defond", "integer"), ("varcons", "integer"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _reaches_without_solid_boundary(study):
|
||||||
|
river = study.river
|
||||||
|
solid = [
|
||||||
|
bc for bc in river.boundary_condition.get_tab("solid")
|
||||||
|
if not bc.is_deleted() and bc.bctype == "SL" and len(bc) > 0
|
||||||
|
]
|
||||||
|
|
||||||
|
return [
|
||||||
|
edge.name for edge in river.enable_edges()
|
||||||
|
if river.is_upstream_node(edge.node1)
|
||||||
|
and not any(bc.node == edge.node1 for bc in solid)
|
||||||
|
]
|
||||||
|
|
||||||
def _parameter_values(self, study):
|
def _parameter_values(self, study):
|
||||||
return {p.name: str(p.value).strip()
|
return {p.name: str(p.value).strip()
|
||||||
for p in study.river.get_params(self.type).parameters}
|
for p in study.river.get_params(self.type).parameters}
|
||||||
|
|||||||
@@ -43,6 +43,13 @@ class RunSolverTranslate(PamhyrTranslate):
|
|||||||
"Export cancelled: REGIME=1 is incompatible with CONDAM=0. "
|
"Export cancelled: REGIME=1 is incompatible with CONDAM=0. "
|
||||||
"A reflecting upstream boundary cannot impose the water depth."
|
"A reflecting upstream boundary cannot impose the water depth."
|
||||||
)
|
)
|
||||||
|
self._dict["missing_solid_boundary"] = _translate(
|
||||||
|
"Solver",
|
||||||
|
"Export cancelled: sediment transport (TRASED) is enabled but "
|
||||||
|
"no solid boundary condition is defined at the upstream node "
|
||||||
|
"of reach(es): {reaches}. Add a solid boundary condition, or "
|
||||||
|
"disable sediment transport in the solver parameters."
|
||||||
|
)
|
||||||
self._dict["export_failed"] = _translate(
|
self._dict["export_failed"] = _translate(
|
||||||
"Solver", "Export failed; task cancelled"
|
"Solver", "Export failed; task cancelled"
|
||||||
)
|
)
|
||||||
Reference in new issue
Block a user