Commit 9f87a381 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Solver: RubarBE: Add MAIL file.

Showing with 57 additions and 0 deletions
+57 -0
...@@ -364,6 +364,26 @@ class Reach(SQLSubModel): ...@@ -364,6 +364,26 @@ class Reach(SQLSubModel):
else: else:
return 0.0 return 0.0
def inter_profiles_kp(self):
res_kp = [self.profile(0).kp]
profiles = iter(self.profiles)
previous = next(profile)
for profile in profiles:
prev = previous.kp
curr = profile.kp
diff = abs(previous.kp - profile.kp)
new = previous.kp + (diff / 2.0)
res_kp.append(new)
previous = profile
res_kp.append(self.profile(len(self) - 1).kp)
return res_kp
# Sediment Layers # Sediment Layers
def get_sl(self): def get_sl(self):
......
...@@ -195,3 +195,40 @@ class RubarBE(CommandLineSolver): ...@@ -195,3 +195,40 @@ class RubarBE(CommandLineSolver):
) )
ind += 1 ind += 1
def _export_mail(self, study, repertory, files, qlog, name="0"):
if qlog is not None:
qlog.put("Export MAIL file")
with open(
os.path.join(
repertory, f"mail.{name}"
), "w+"
) as f:
for edge in study.river.enable_edges():
lm = len(edge) + 1
f.write(f"{lm:>13}")
# TMAIL
ind = 0
for inter in edge.reach.inter_profiles_kp():
f.write(f"{inter:15.3f}")
ind += 1
if ind % 3 == 0:
f.write("\n")
# New line (if last iteration do not finish with new
# line)
if ind % 3 != 0:
f.write("\n")
# XTMAIL
ind = 0
for profile in edge.reach.profiles:
f.write(f" {profile.kp:15.3f} ")
ind += 1
if ind % 3 == 0:
f.write("\n")
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