Skip to content

Commit 42443ee

Browse files
committed
don't unpack equilibrium if code output flag shows error and better error logging'
1 parent ddf63a3 commit 42443ee

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

torax/_src/orchestration/run_muscle3.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,24 @@
4242

4343

4444
class ToraxMuscleRunner:
45+
# first_run
4546
first_run: bool = True
4647
output_all_timeslices: bool = False
4748
db_out: Optional[IDSToplevel] = None
4849
torax_config = None
4950
dynamic_runtime_params_slice_provider = None
50-
sim_state = None
51-
post_processed_outputs = None
5251
step_fn = None
5352
time_step_calculator_dynamic_params = None
53+
equilibrium_interval = None
54+
55+
# state
56+
sim_state = None
57+
post_processed_outputs = None
5458
extra_var_col = None
5559
t_cur = None
5660
t_next_inner = None
5761
t_next_outer = None
5862
finished = False
59-
equilibrium_interval = None
6063
last_equilibrium_call = - np.inf
6164

6265
def __init__(self):
@@ -79,11 +82,6 @@ def run_sim(self):
7982
self.run_o_i()
8083
self.run_s()
8184
self.run_timestep()
82-
not_done = self.step_fn.time_step_calculator.not_done(
83-
self.t_cur,
84-
self.t_final,
85-
self.time_step_calculator_dynamic_params,
86-
)
8785
self.run_o_f()
8886

8987
self.finished = True
@@ -188,7 +186,7 @@ def run_timestep(self):
188186
self.db_out.put_slice(equilibrium_data)
189187

190188
if sim_error != SimError.NO_ERROR:
191-
raise Exception()
189+
raise Exception(sim_error)
192190

193191
def run_o_f(self):
194192
if self.output_all_timeslices:
@@ -220,6 +218,10 @@ def receive_equilibrium(self, port_name: str):
220218
self.t_next_outer = t_next
221219
elif port_name == "s":
222220
self.t_next_inner = t_next
221+
222+
if equilibrium_data.code.output_flag[0] == -1:
223+
return
224+
223225
geometry_configs = {}
224226
torax_config_dict = get_geometry_config_dict(self.torax_config)
225227
torax_config_dict["geometry_type"] = "imas"

0 commit comments

Comments
 (0)