@@ -199,6 +199,7 @@ def theta_method_block_residual(
199199 runtime_params_t_plus_dt : runtime_params_lib .RuntimeParams ,
200200 geo_t_plus_dt : geometry .Geometry ,
201201 x_old : tuple [cell_variable .CellVariable , ...],
202+ core_profiles_t : state .CoreProfiles ,
202203 core_profiles_t_plus_dt : state .CoreProfiles ,
203204 explicit_source_profiles : source_profiles .SourceProfiles ,
204205 physics_models : physics_models_lib .PhysicsModels ,
@@ -214,6 +215,8 @@ def theta_method_block_residual(
214215 runtime_params_t_plus_dt: Runtime parameters for time t + dt.
215216 geo_t_plus_dt: The geometry at time t + dt.
216217 x_old: The starting x defined as a tuple of CellVariables.
218+ core_profiles_t: Core plasma profiles which contain all available
219+ prescribed quantities at the start of the time step.
217220 core_profiles_t_plus_dt: Core plasma profiles which contain all available
218221 prescribed quantities at the end of the time step. This includes evolving
219222 boundary conditions and prescribed time-dependent profiles that are not
@@ -244,7 +247,9 @@ def theta_method_block_residual(
244247 runtime_params_t_plus_dt ,
245248 geo_t_plus_dt ,
246249 core_profiles_t_plus_dt ,
247- evolving_names ,
250+ prev_core_profiles = core_profiles_t ,
251+ dt = dt ,
252+ evolving_names = evolving_names ,
248253 )
249254 coeffs_new = calc_coeffs .calc_coeffs (
250255 runtime_params = runtime_params_t_plus_dt ,
@@ -288,6 +293,7 @@ def theta_method_block_loss(
288293 runtime_params_t_plus_dt : runtime_params_lib .RuntimeParams ,
289294 geo_t_plus_dt : geometry .Geometry ,
290295 x_old : tuple [cell_variable .CellVariable , ...],
296+ core_profiles_t : state .CoreProfiles ,
291297 core_profiles_t_plus_dt : state .CoreProfiles ,
292298 explicit_source_profiles : source_profiles .SourceProfiles ,
293299 physics_models : physics_models_lib .PhysicsModels ,
@@ -303,6 +309,7 @@ def theta_method_block_loss(
303309 runtime_params_t_plus_dt: Runtime parameters for time t + dt.
304310 geo_t_plus_dt: geometry object at time t + dt.
305311 x_old: The starting x defined as a tuple of CellVariables.
312+ core_profiles_t: Core profiles from the previous time step.
306313 core_profiles_t_plus_dt: Core plasma profiles which contain all available
307314 prescribed quantities at the end of the time step. This includes evolving
308315 boundary conditions and prescribed time-dependent profiles that are not
@@ -324,6 +331,7 @@ def theta_method_block_loss(
324331 geo_t_plus_dt = geo_t_plus_dt ,
325332 x_old = x_old ,
326333 x_new_guess_vec = x_new_guess_vec ,
334+ core_profiles_t = core_profiles_t ,
327335 core_profiles_t_plus_dt = core_profiles_t_plus_dt ,
328336 explicit_source_profiles = explicit_source_profiles ,
329337 physics_models = physics_models ,
@@ -347,6 +355,7 @@ def jaxopt_solver(
347355 geo_t_plus_dt : geometry .Geometry ,
348356 x_old : tuple [cell_variable .CellVariable , ...],
349357 init_x_new_vec : jax .Array ,
358+ core_profiles_t : state .CoreProfiles ,
350359 core_profiles_t_plus_dt : state .CoreProfiles ,
351360 explicit_source_profiles : source_profiles .SourceProfiles ,
352361 physics_models : physics_models_lib .PhysicsModels ,
@@ -364,6 +373,7 @@ def jaxopt_solver(
364373 x_old: The starting x defined as a tuple of CellVariables.
365374 init_x_new_vec: Flattened array of initial guess of x_new for all evolving
366375 core profiles.
376+ core_profiles_t: Core profiles from the previous time step.
367377 core_profiles_t_plus_dt: Core plasma profiles which contain all available
368378 prescribed quantities at the end of the time step. This includes evolving
369379 boundary conditions and prescribed time-dependent profiles that are not
@@ -389,6 +399,7 @@ def jaxopt_solver(
389399 runtime_params_t_plus_dt = runtime_params_t_plus_dt ,
390400 geo_t_plus_dt = geo_t_plus_dt ,
391401 x_old = x_old ,
402+ core_profiles_t = core_profiles_t ,
392403 core_profiles_t_plus_dt = core_profiles_t_plus_dt ,
393404 explicit_source_profiles = explicit_source_profiles ,
394405 physics_models = physics_models ,
0 commit comments