Skip to content

Commit

Permalink
Add Geometry to ToraxSimState.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 718842985
  • Loading branch information
Nush395 authored and Torax team committed Jan 23, 2025
1 parent e99b0b3 commit b576fac
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions torax/orchestration/step_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def step(
post_processed_outputs=state.PostProcessedOutputs.zeros(geo_t_plus_dt),
time_step_calculator_state=time_step_calculator_state,
stepper_numeric_outputs=stepper_numeric_outputs,
geometry=geo_t_plus_dt,
)

def adaptive_step(
Expand Down
1 change: 1 addition & 0 deletions torax/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def get_initial_state(
outer_stepper_iterations=0,
inner_solver_iterations=0,
),
geometry=geo,
)


Expand Down
4 changes: 4 additions & 0 deletions torax/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ class ToraxSimState:
running `run_simulation()`.
post_processed_outputs: variables for output or intermediate observations
for overarching workflows, calculated after each simulation step.
geometry: Geometry at this time step used for the simulation.
time_step_calculator_state: the state of the TimeStepper.
stepper_numeric_outputs: Numerical quantities related to the stepper.
"""
Expand All @@ -531,6 +532,9 @@ class ToraxSimState:
# Post-processed outputs after a step.
post_processed_outputs: PostProcessedOutputs

# Geometry used for the simulation.
geometry: geometry.Geometry

# Other "side" states used for logging and feeding to other components of
# TORAX.
time_step_calculator_state: Any
Expand Down
1 change: 1 addition & 0 deletions torax/tests/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def setUp(self):
stepper_error_state=1,
inner_solver_iterations=1,
),
geometry=self.geo,
)
sim_error = state.SimError.NO_ERROR

Expand Down
1 change: 1 addition & 0 deletions torax/tests/post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def test_make_outputs(self):
stepper_error_state=1,
inner_solver_iterations=1,
),
geometry=self.geo,
)

updated_sim_state = post_processing.make_outputs(sim_state, self.geo)
Expand Down

0 comments on commit b576fac

Please sign in to comment.