Skip to content

Commit

Permalink
Enable set_pped_tpedratio_nped pedestal model in build_sim
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 723679418
  • Loading branch information
jcitrin authored and Torax team committed Feb 5, 2025
1 parent e410d09 commit cafcf4f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion torax/config/build_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from torax.geometry import geometry_provider
from torax.geometry import standard_geometry
from torax.pedestal_model import pedestal_model as pedestal_model_lib
from torax.pedestal_model import set_pped_tpedratio_nped
from torax.pedestal_model import set_tped_nped
from torax.sources import register_source
from torax.sources import runtime_params as source_runtime_params_lib
Expand Down Expand Up @@ -591,14 +592,24 @@ def build_pedestal_model_builder_from_config(
pedestal_config: dict[str, Any],
) -> pedestal_model_lib.PedestalModelBuilder:
"""Builds a `PedestalModelBuilder` from the input config."""
pedestal_model = pedestal_config.pop('pedestal_model', 'set_tped_nped')
pedestal_model = pedestal_config.pop('pedestal_model', None)
if pedestal_model is None:
raise ValueError(
"The 'pedestal_model' key is required in the pedestal configuration."
)
match pedestal_model:
case 'set_tped_nped':
return set_tped_nped.SetTemperatureDensityPedestalModelBuilder(
runtime_params=config_args.recursive_replace(
set_tped_nped.RuntimeParams(), **pedestal_config
)
)
case 'set_pped_tpedratio_nped':
return set_pped_tpedratio_nped.SetPressureTemperatureRatioAndDensityPedestalModelBuilder(
runtime_params=config_args.recursive_replace(
set_pped_tpedratio_nped.RuntimeParams(), **pedestal_config
)
)
case _:
raise ValueError(f'Unknown pedestal model: {pedestal_model}')

Expand Down

0 comments on commit cafcf4f

Please sign in to comment.