Skip to content

Commit 5d30d36

Browse files
jcitrinTorax team
authored andcommitted
Add simulation time t to RuntimeParams.
This is a prerequisite for pedestal transition ramp scaling, which needs access to the simulation time in calc_coeffs for ADAPTIVE_SOURCE transition ramps. PiperOrigin-RevId: 890681046
1 parent 526a636 commit 5d30d36

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

torax/_src/config/build_runtime_params.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import equinox as eqx
2929
import jax
3030
from jax import numpy as jnp
31+
from torax._src import jax_utils
3132
from torax._src import state as state_lib
3233
from torax._src.config import numerics as numerics_lib
3334
from torax._src.config import runtime_params as runtime_params_lib
@@ -119,6 +120,7 @@ def __call__(
119120
) -> runtime_params_lib.RuntimeParams:
120121
"""Returns a runtime_params.RuntimeParams to use during time t."""
121122
return runtime_params_lib.RuntimeParams(
123+
t=jnp.asarray(t, dtype=jax_utils.get_dtype()),
122124
transport=self.transport_model.build_runtime_params(t),
123125
solver=self.solver.build_runtime_params,
124126
sources={
@@ -352,8 +354,8 @@ def get_consistent_runtime_params_and_geometry(
352354
``density_fraction`` boundary condition mode to derive ``n_e_right_bc``
353355
from the evolved electron density. If ``None`` (e.g. at initialization),
354356
the prescribed ``n_e`` from the runtime params is used.
355-
is_initialization: Indicates if the simulation is currently initializing.
356-
If this is `False`, then `core_profiles` cannot be `None`.
357+
is_initialization: Indicates if the simulation is currently initializing. If
358+
this is `False`, then `core_profiles` cannot be `None`.
357359
358360
Returns:
359361
A tuple of (RuntimeParams, Geometry).

torax/_src/config/runtime_params.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import dataclasses
4141

4242
import jax
43+
from torax._src import array_typing
4344
from torax._src.config import numerics
4445
from torax._src.core_profiles import profile_conditions
4546
from torax._src.core_profiles.plasma_composition import plasma_composition
@@ -75,6 +76,7 @@ class RuntimeParams:
7576
be changed without recompilation.
7677
"""
7778

79+
t: array_typing.FloatScalar
7880
edge: edge_runtime_params.RuntimeParams | None
7981
mhd: mhd_runtime_params.RuntimeParams
8082
neoclassical: neoclassical_params.RuntimeParams

0 commit comments

Comments
 (0)