diff --git a/src/Solver/AdisTT.py b/src/Solver/AdisTT.py index b840bcfb..9c6214e6 100644 --- a/src/Solver/AdisTT.py +++ b/src/Solver/AdisTT.py @@ -457,22 +457,31 @@ class AdisTTwc(AdisTT): with adistt_file_open( os.path.join(repertory, f"{name}.POL"), "w+" ) as f: - + TEM_ICs = ( - study.river._InitialConditionsTemperature.Initial_Conditions_List[0] + study.river._InitialConditionsTemperature + .Initial_Conditions_List ) - if TEM_ICs._temperature is not None: + TEM_IC = TEM_ICs[0] if TEM_ICs else None + print(f"TEM_IC: {TEM_IC}") + + if TEM_IC and TEM_IC._temperature is not None: + print(f"TEM_IC._temperature: {TEM_IC._temperature}") f.write(f"file_ini = {name}.INI\n") self._export_ICs_AdisTT( - study, repertory, TEM_ICs, qlog, name + study, repertory, TEM_IC, qlog, name + ) + else: + logger.info( + "No TEM initial conditions defined, skipping export" ) - TEM_BCs =( + TEM_BCs = ( study.river._BoundaryConditionsTemperature.BCs_Temperature_List ) - if len(TEM_BCs) != 0: + if TEM_BCs: f.write(f"file_cl = {name}.CDT\n") self._export_BCs_AdisTT( study, repertory, TEM_BCs, qlog, name @@ -517,7 +526,9 @@ class AdisTTwc(AdisTT): ), "w+") as f: f.write(f"*État initial pour le polluant {TEM_name}\n") f.write(" ".join(("DEFAULT =", - f"{TEM_IC_default.temperature}\n"))) + f"{TEM_IC_default.temperature}", + "0.0 0.0 0.0\n"))) + # fake 0 to match adists if len(TEM_IC_default._data) != 0: self._export_ICs_AdisTT_Spec( @@ -539,7 +550,9 @@ class AdisTTwc(AdisTT): f"{study.river.get_edge_id(reach)+1}", f"{ic_spec.start_rk}", f"{ic_spec.end_rk}", - f"{ic_spec.temperature}\n"))) + f"{ic_spec.temperature}" + f"0.0 0.0 0.0 0.0\n"))) + # fake 0 to match adists return True diff --git a/src/tools.py b/src/tools.py index b4de6800..9ea2fb80 100644 --- a/src/tools.py +++ b/src/tools.py @@ -321,7 +321,7 @@ def timestamp_to_old_pamhyr_date_adists(time: int): minutes = (dt.seconds % 3600) // 60 seconds = dt.seconds % 60 - s = f"{dt.days:>3}:{hours:>2}:{minutes:>2}:{seconds:>2}" + s = f"{dt.days:>3}:{hours:>2}:{minutes:>2}" s = s.replace(" ", "0") return s