NumericalInverse.py
def evaluate_one_step(self) -> None:
        """
        Running one whole step of the inverse simulation, until the point
            we are satisfied with the results
        We are done with the step when the difference of two successive
            error values is less than the tolerance that was set in __init__

        NOTE: We are overriding parent evaluate_one_step() method to expose
            same public method.
        Superb article about overriding and its best practices can be found here:
            https://www.thedigitalcatonline.com/blog/2014/05/19/method-overriding-in-python/
        """

        # checkpoint previous state so we can revert to it
        self._make_checkpoint()
        # initial adjustments to heat flux being currently solved
        q_adj = self.init_q_adjustment
        # Assigning all the fluxes in the windows we are interested to be
        #   the previously solved heat flux
        self.HeatFlux[self.current_q_idx:self.current_q_idx+self.window_span] = self.HeatFlux[self.current_q_idx-1]
        prev_error = self._evaluate_window_error_norm()
        iter_no = 0
        while True:
            # simulate few steps
            iter_no += 1
            self._evaluate_n_steps(n_steps=self.window_span)
            new_error = self._evaluate_window_error_norm()

            # When we are satisfied with the heat flux, finish the loop,
            #   otherwise continue with adjusting it
            if abs(prev_error - new_error) < self.tolerance or new_error < self.tolerance:
                # revert simulation to last checkpoint and make only one step
                self._revert_to_checkpoint()
                super().evaluate_one_step()
                # print("Accepting Flux: {} at time {} with Error {} after {} iterations".format(
                #     self.HeatFlux[self.current_q_idx], self.t[self.current_q_idx], new_error, iter_no))

                self.number_of_iterations += iter_no
                break
            else:
                # When the new error is higher than the previous one, we want
                #   to start making smaller adjustments in the opposite direction
                # Otherwise continue with current adjustments
                if new_error > prev_error:
                    q_adj *= self.adjusting_value
                # Saving the error and reverting to the last checkpoint
                prev_error = new_error
                self._revert_to_checkpoint()

            # adjust heatflux a little in all the windows
            self.HeatFlux[self.current_q_idx:self.current_q_idx+self.window_span] += q_adj
        # Since the current flux is adjusted enough tell the Prob to adjust
        #   next one in next SolveInverseStep call
        self.current_q_idx += 1

        Running one whole step of the inverse simulation, until the point
            we are satisfied with the results
        We are done with the step when the difference of two successive
            error values is less than the tolerance that was set in __init__

        NOTE: We are overriding parent evaluate_one_step() method to expose
            same public method.
        Superb article about overriding and its best practices can be found here:
            https://www.thedigitalcatonline.com/blog/2014/05/19/method-overriding-in-python/
        
Running one whole step of the inverse simulation, until the point
we are satisfied with the results
We are done with the step when the difference of two successive
error values is less than the tolerance that was set in __init

We are overriding parent evaluate_one_step() method to expose
same public method.
Running one whole step of the inverse simulation until the point we are satisfied with the results We are done with the step when the difference of two successive error values is less than the tolerance that was set in __init We are overriding parent evaluate_one_step () method to expose same public method .
def evaluate_one_step(self) -> None:
        self._make_checkpoint()
        q_adj = self.init_q_adjustment
        self.HeatFlux[self.current_q_idx:self.current_q_idx+self.window_span] = self.HeatFlux[self.current_q_idx-1]
        prev_error = self._evaluate_window_error_norm()
        iter_no = 0
        while True:
            iter_no += 1
            self._evaluate_n_steps(n_steps=self.window_span)
            new_error = self._evaluate_window_error_norm()
            if abs(prev_error - new_error) < self.tolerance or new_error < self.tolerance:
                self._revert_to_checkpoint()
                super().evaluate_one_step()
                self.number_of_iterations += iter_no
                break
            else:
                if new_error > prev_error:
                    q_adj *= self.adjusting_value
                prev_error = new_error
                self._revert_to_checkpoint()
            self.HeatFlux[self.current_q_idx:self.current_q_idx+self.window_span] += q_adj
        self.current_q_idx += 1
def evaluate_one_step ( self ) -> None : self . _make_checkpoint ( ) q_adj = self . init_q_adjustment self . HeatFlux [ self . current_q_idx : self . current_q_idx + self . window_span ] = self . HeatFlux [ self . current_q_idx - 1 ] prev_error = self . _evaluate_window_error_norm ( ) iter_no = 0 while True : iter_no += 1 self . _evaluate_n_steps ( n_steps = self . window_span ) new_error = self . _evaluate_window_error_norm ( ) if abs ( prev_error - new_error ) < self . tolerance or new_error < self . tolerance : self . _revert_to_checkpoint ( ) super ( ) . evaluate_one_step ( ) self . number_of_iterations += iter_no break else : if new_error > prev_error : q_adj *= self . adjusting_value prev_error = new_error self . _revert_to_checkpoint ( ) self . HeatFlux [ self . current_q_idx : self . current_q_idx + self . window_span ] += q_adj self . current_q_idx += 1
Running one whole step of the inverse simulation, until the point
we are satisfied with the results
We are done with the step when the difference of two successive
error values is less than the tolerance that was set in __init__
Running one whole step of the inverse simulation until the point we are satisfied with the results We are done with the step when the difference of two successive error values is less than the tolerance that was set in __init__
"""
        Running one whole step of the inverse simulation, until the point
            we are satisfied with the results
        We are done with the step when the difference of two successive
            error values is less than the tolerance that was set in __init__

        NOTE: We are overriding parent evaluate_one_step() method to expose
            same public method.
        Superb article about overriding and its best practices can be found here:
            https://www.thedigitalcatonline.com/blog/2014/05/19/method-overriding-in-python/
        """ # checkpoint previous state so we can revert to it # initial adjustments to heat flux being currently solved # Assigning all the fluxes in the windows we are interested to be #   the previously solved heat flux # simulate few steps # When we are satisfied with the heat flux, finish the loop, #   otherwise continue with adjusting it # revert simulation to last checkpoint and make only one step # print("Accepting Flux: {} at time {} with Error {} after {} iterations".format( #     self.HeatFlux[self.current_q_idx], self.t[self.current_q_idx], new_error, iter_no)) # When the new error is higher than the previous one, we want #   to start making smaller adjustments in the opposite direction # Otherwise continue with current adjustments # Saving the error and reverting to the last checkpoint # adjust heatflux a little in all the windows # Since the current flux is adjusted enough tell the Prob to adjust #   next one in next SolveInverseStep call
self