3838from torax ._src .fvm import discrete_system
3939from torax ._src .fvm import fvm_conversions
4040from torax ._src .geometry import geometry
41+ from torax ._src .pedestal_policy import pedestal_policy
4142from torax ._src .sources import source_profiles
4243
4344Block1DCoeffs : TypeAlias = block_1d_coeffs .Block1DCoeffs
@@ -200,6 +201,7 @@ def theta_method_block_residual(
200201 x_old : tuple [cell_variable .CellVariable , ...],
201202 core_profiles_t_plus_dt : state .CoreProfiles ,
202203 explicit_source_profiles : source_profiles .SourceProfiles ,
204+ pedestal_policy_state : pedestal_policy .PedestalPolicyState ,
203205 physics_models : physics_models_lib .PhysicsModels ,
204206 coeffs_old : Block1DCoeffs ,
205207 evolving_names : tuple [str , ...],
@@ -219,6 +221,7 @@ def theta_method_block_residual(
219221 being evolved by the PDE system.
220222 explicit_source_profiles: Pre-calculated sources implemented as explicit
221223 sources in the PDE.
224+ pedestal_policy_state: State variables held by the pedestal policy.
222225 physics_models: Physics models used for the calculations.
223226 coeffs_old: The coefficients calculated at x_old.
224227 evolving_names: The names of variables within the core profiles that should
@@ -251,6 +254,7 @@ def theta_method_block_residual(
251254 core_profiles = core_profiles_t_plus_dt ,
252255 explicit_source_profiles = explicit_source_profiles ,
253256 physics_models = physics_models ,
257+ pedestal_policy_state = pedestal_policy_state ,
254258 evolving_names = evolving_names ,
255259 use_pereverzev = False ,
256260 )
@@ -288,6 +292,7 @@ def theta_method_block_loss(
288292 x_old : tuple [cell_variable .CellVariable , ...],
289293 core_profiles_t_plus_dt : state .CoreProfiles ,
290294 explicit_source_profiles : source_profiles .SourceProfiles ,
295+ pedestal_policy_state : pedestal_policy .PedestalPolicyState ,
291296 physics_models : physics_models_lib .PhysicsModels ,
292297 coeffs_old : Block1DCoeffs ,
293298 evolving_names : tuple [str , ...],
@@ -307,6 +312,7 @@ def theta_method_block_loss(
307312 being evolved by the PDE system.
308313 explicit_source_profiles: pre-calculated sources implemented as explicit
309314 sources in the PDE
315+ pedestal_policy_state: State variables held by the pedestal policy.
310316 physics_models: Physics models used for the calculations.
311317 coeffs_old: The coefficients calculated at x_old.
312318 evolving_names: The names of variables within the core profiles that should
@@ -324,6 +330,7 @@ def theta_method_block_loss(
324330 x_new_guess_vec = x_new_guess_vec ,
325331 core_profiles_t_plus_dt = core_profiles_t_plus_dt ,
326332 explicit_source_profiles = explicit_source_profiles ,
333+ pedestal_policy_state = pedestal_policy_state ,
327334 physics_models = physics_models ,
328335 coeffs_old = coeffs_old ,
329336 evolving_names = evolving_names ,
@@ -346,6 +353,7 @@ def jaxopt_solver(
346353 init_x_new_vec : jax .Array ,
347354 core_profiles_t_plus_dt : state .CoreProfiles ,
348355 explicit_source_profiles : source_profiles .SourceProfiles ,
356+ pedestal_policy_state : pedestal_policy .PedestalPolicy ,
349357 physics_models : physics_models_lib .PhysicsModels ,
350358 coeffs_old : Block1DCoeffs ,
351359 evolving_names : tuple [str , ...],
@@ -367,6 +375,7 @@ def jaxopt_solver(
367375 being evolved by the PDE system.
368376 explicit_source_profiles: pre-calculated sources implemented as explicit
369377 sources in the PDE.
378+ pedestal_policy_state: State variables held by the pedestal policy.
370379 physics_models: Physics models used for the calculations.
371380 coeffs_old: The coefficients calculated at x_old.
372381 evolving_names: The names of variables within the core profiles that should
@@ -391,6 +400,7 @@ def jaxopt_solver(
391400 physics_models = physics_models ,
392401 coeffs_old = coeffs_old ,
393402 evolving_names = evolving_names ,
403+ pedestal_policy_state = pedestal_policy_state ,
394404 )
395405 solver = jaxopt .LBFGS (fun = loss , maxiter = maxiter , tol = tol )
396406 solver_output = solver .run (init_x_new_vec )
0 commit comments