Skip to content

Commit

Permalink
log outputs and only iterpolate active shells taus
Browse files Browse the repository at this point in the history
  • Loading branch information
DeerWhale committed Jan 13, 2025
1 parent d4d5955 commit 76caf4a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tardis/workflows/v_inner_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def __init__(self, configuration, mean_optical_depth="rosseland", tau=None):
if tau is not None:
self.TAU_TARGET = np.log(tau)

self.iterations_mean_optical_depth = np.full((self.total_iterations, self.simulation_state.no_of_shells), np.nan)
self.iterations_values = {'t_radiative':[], 'dilution_factor':[], 't_inner':[], 'v_inner_boundary':[], 'mask':[]}

initial_v_inner = self.estimate_v_inner()

self.simulation_state.geometry.v_inner_boundary = initial_v_inner
Expand All @@ -56,9 +59,11 @@ def estimate_v_inner(self):
)[self.mean_optical_depth]
)

self.iterations_mean_optical_depth[self.completed_iterations,self.simulation_state.geometry.v_inner_boundary_index:] = tau_integ[self.simulation_state.geometry.v_inner_boundary_index:]

interpolator = interp1d(
tau_integ,
self.simulation_state.geometry.v_inner, # Only use the active values as we only need a numerical estimate, not an index
tau_integ[self.simulation_state.geometry.v_inner_boundary_index:],
self.simulation_state.geometry.v_inner[self.simulation_state.geometry.v_inner_boundary_index:], # Only use the active values as we only need a numerical estimate, not an index
fill_value="extrapolate",
)

Expand Down Expand Up @@ -331,6 +336,8 @@ def run(self):
converged = self.check_convergence(estimated_values)

self.completed_iterations += 1
for key, value in estimated_values.items():
self.iterations_values[key].append(value)

if converged and self.convergence_strategy.stop_if_converged:
break
Expand Down

0 comments on commit 76caf4a

Please sign in to comment.