parameters: (self)
return_statement: return True
docstring: Perform a local solution loop until the time step size shrinks to the target bounds.
docstring_summary: Perform a local solution loop until the time step size shrinks to the target bounds.
docstring_tokens: Perform a local solution loop until the time step size shrinks to the target bounds .
function: def SolveSolutionStep(self) -> bool:
          """Perform a local solution loop until the time step size shrinks to the target bounds."""
          # Note:
          # To stick to the original implementation, 3 initial steps are taken
          # without solving the system, though I'd assume we only need 2.
          while True and (3 < self.model_part.ProcessInfo[KratosMultiphysics.STEP]):
              self.__SolveLocalSolutionStep()
  
              # Check step size and revert if it's too large
              # Note: does hardcoding a 0.95 safety factor make sense here
              # or should it be variable?
              step_size_estimate = self.__EstimateTimeStep(0.95, self.current_max_step_size)
  
              if step_size_estimate < self.current_step_size:
                  # Log failure
                  self.__Log("Reducing time step ...")
                  time = self.model_part.ProcessInfo[KratosMultiphysics.TIME]
                  self.__Log("Failed time: {}".format(time))
                  self.__Log("Failed step size: {}".format(self.current_step_size))
  
                  # Clear step data
                  self.fluid_solver.ReduceTimeStep(self.model_part, time)
  
                  # Get reduced step
                  time -= self.current_step_size
                  self.safety_factor *= self.reduction_on_failure
                  self.current_step_size = self.__EstimateTimeStep(
                      self.safety_factor,
                      self.current_max_step_size)
                  time += self.current_step_size
  
                  self.__Log("Reduced time: {}".format(time))
                  self.__Log("Reduced step size: {}".format(self.current_step_size))
  
                  self.fluid_solver.ReduceTimeStep(self.model_part, time)
              else:
                  break
  
          return True
function_tokens: def SolveSolutionStep ( self ) -> bool : # Note: # To stick to the original implementation, 3 initial steps are taken # without solving the system, though I'd assume we only need 2. while True and ( 3 < self . model_part . ProcessInfo [ KratosMultiphysics . STEP ] ) : self . __SolveLocalSolutionStep ( ) # Check step size and revert if it's too large # Note: does hardcoding a 0.95 safety factor make sense here # or should it be variable? step_size_estimate = self . __EstimateTimeStep ( 0.95 , self . current_max_step_size ) if step_size_estimate < self . current_step_size : # Log failure self . __Log ( "Reducing time step ..." ) time = self . model_part . ProcessInfo [ KratosMultiphysics . TIME ] self . __Log ( "Failed time: {}" . format ( time ) ) self . __Log ( "Failed step size: {}" . format ( self . current_step_size ) ) # Clear step data self . fluid_solver . ReduceTimeStep ( self . model_part , time ) # Get reduced step time -= self . current_step_size self . safety_factor *= self . reduction_on_failure self . current_step_size = self . __EstimateTimeStep ( self . safety_factor , self . current_max_step_size ) time += self . current_step_size self . __Log ( "Reduced time: {}" . format ( time ) ) self . __Log ( "Reduced step size: {}" . format ( self . current_step_size ) ) self . fluid_solver . ReduceTimeStep ( self . model_part , time ) else : break return True