mirror of https://gitlab.com/pamhyr/pamhyr2
Solver: RubarBE: Add MAIL file.
parent
329572d191
commit
9f87a38107
|
|
@ -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):
|
||||||
)
|
)
|
||||||
|
|
||||||
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")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue