diff --git a/docs/model_integration.rst b/docs/model_integration.rst index 768e59f3..e19e8b91 100644 --- a/docs/model_integration.rst +++ b/docs/model_integration.rst @@ -312,14 +312,6 @@ the |torax.sim.Sim|_ object. .. code-block:: python - # in sim.py. Copied here for reference, no need to modify this. - - def build_sim_object( - ... - transport_model_builder: transport_model_lib.TransportModelBuilder, - ... - ) -> Sim: - # in your TORAX configuration or run file .py my_custom_transport_builder = MyCustomTransportModelBuilder() @@ -334,7 +326,7 @@ the |torax.sim.Sim|_ object. my_custom_transport_builder.runtime_params.bar = 4.0 # Build the Sim object. - sim_object = sim_lib.build_sim_object( + sim_object = sim_lib.Sim.create( ..., transport_model_builder=my_custom_transport_builder, ... @@ -348,7 +340,7 @@ As of 7 June 2024, you cannot instantiate and configure a custom transport model via the config dictionary. You may still configure the other components of your TORAX simulation via the config dict and use other functions in |torax.config.build_sim|_ to convert those to the objects you can pass into -``build_sim_object()``. We are working on making this easier, but reach out +``Sim.create()``. We are working on making this easier, but reach out if this is something you need. diff --git a/torax/config/build_sim.py b/torax/config/build_sim.py index f2eb53af..7c9e3902 100644 --- a/torax/config/build_sim.py +++ b/torax/config/build_sim.py @@ -270,7 +270,7 @@ def build_sim_from_config( else: file_restart = None - return sim_lib.build_sim_object( + return sim_lib.Sim.create( runtime_params=runtime_params, geometry_provider=geo_provider, source_models_builder=build_sources_builder_from_config( diff --git a/torax/sim.py b/torax/sim.py index 43fbaf37..d02dddc4 100644 --- a/torax/sim.py +++ b/torax/sim.py @@ -1042,29 +1042,6 @@ def _override_initial_state_post_processed_outputs_from_file( return post_processed_outputs -def build_sim_object( - runtime_params: general_runtime_params.GeneralRuntimeParams, - geometry_provider: geometry_provider_lib.GeometryProvider, - stepper_builder: stepper_lib.StepperBuilder, - transport_model_builder: transport_model_lib.TransportModelBuilder, - source_models_builder: source_models_lib.SourceModelsBuilder, - pedestal_model_builder: pedestal_model_lib.PedestalModelBuilder, - time_step_calculator: Optional[ts.TimeStepCalculator] = None, - file_restart: Optional[general_runtime_params.FileRestart] = None, -) -> Sim: - """Builds a Sim object from the input runtime params and sim components.""" - return Sim.create( - runtime_params=runtime_params, - geometry_provider=geometry_provider, - stepper_builder=stepper_builder, - transport_model_builder=transport_model_builder, - source_models_builder=source_models_builder, - pedestal_model_builder=pedestal_model_builder, - time_step_calculator=time_step_calculator, - file_restart=file_restart, - ) - - def _run_simulation( static_runtime_params_slice: runtime_params_slice.StaticRuntimeParamsSlice, dynamic_runtime_params_slice_provider: runtime_params_slice.DynamicRuntimeParamsSliceProvider, diff --git a/torax/tests/sim.py b/torax/tests/sim.py index 9eaba011..6cf3cb45 100644 --- a/torax/tests/sim.py +++ b/torax/tests/sim.py @@ -481,7 +481,7 @@ def test_no_op(self): geometry.build_circular_geometry() ) - sim = sim_lib.build_sim_object( + sim = sim_lib.Sim.create( runtime_params=runtime_params, geometry_provider=geo_provider, stepper_builder=linear_theta_method.LinearThetaMethodBuilder(), diff --git a/torax/tests/sim_custom_sources.py b/torax/tests/sim_custom_sources.py index 654b9434..ffdbdb4e 100644 --- a/torax/tests/sim_custom_sources.py +++ b/torax/tests/sim_custom_sources.py @@ -191,7 +191,7 @@ def custom_source_formula( geo_provider = geometry_provider.ConstantGeometryProvider( geometry.build_circular_geometry() ) - sim = sim_lib.build_sim_object( + sim = sim_lib.Sim.create( runtime_params=self.test_particle_sources_constant_runtime_params, geometry_provider=geo_provider, stepper_builder=self.stepper_builder, diff --git a/torax/tests/sim_time_dependence.py b/torax/tests/sim_time_dependence.py index 68722112..e6375960 100644 --- a/torax/tests/sim_time_dependence.py +++ b/torax/tests/sim_time_dependence.py @@ -77,7 +77,7 @@ def test_time_dependent_params_update_in_adaptive_dt( # max combined value of Ti_bound_right should be 2.5. Higher will make the # error state from the stepper be 1. time_calculator = fixed_time_step_calculator.FixedTimeStepCalculator() - sim = sim_lib.build_sim_object( + sim = sim_lib.Sim.create( runtime_params=runtime_params, geometry_provider=geometry_provider, stepper_builder=FakeStepperBuilder( diff --git a/torax/tests/test_data/test_explicit.py b/torax/tests/test_data/test_explicit.py index 7c805d56..6cd2c320 100644 --- a/torax/tests/test_data/test_explicit.py +++ b/torax/tests/test_data/test_explicit.py @@ -106,7 +106,7 @@ def get_sim() -> sim_lib.Sim: # config taking place via constructor args in this function. runtime_params = get_runtime_params() geo_provider = get_geometry_provider() - return sim_lib.build_sim_object( + return sim_lib.Sim.create( runtime_params=runtime_params, geometry_provider=geo_provider, source_models_builder=get_sources_builder(),