parameters: (self)
docstring: This method is executed before starting the time loop
  
          Keyword arguments:
          self -- It signifies an instance of a class.
docstring_summary: This method is executed before starting the time loop
docstring_tokens: This method is executed before starting the time loop
function: def ExecuteBeforeSolutionLoop(self):
          """ This method is executed before starting the time loop
  
          Keyword arguments:
          self -- It signifies an instance of a class.
          """
  
          # The general damping ratios
          damping_ratio_0 = self.settings["damping_ratio_0"].GetDouble()
          damping_ratio_1 = self.settings["damping_ratio_1"].GetDouble()
  
          # We get the model parts which divide the problem
          current_process_info = self.main_model_part.ProcessInfo
          existing_computation = current_process_info.Has(SMA.EIGENVALUE_VECTOR)
  
          # Create auxiliar parameters
          compute_damping_coefficients_settings = KM.Parameters("""
          {
              "echo_level"          : 0,
              "damping_ratio_0"     : 0.0,
              "damping_ratio_1"     : -1.0,
              "eigen_values_vector" : [0.0]
          }
          """)
  
          # Setting custom parameters
          compute_damping_coefficients_settings["echo_level"].SetInt(self.settings["echo_level"].GetInt())
          compute_damping_coefficients_settings["damping_ratio_0"].SetDouble(damping_ratio_0)
          compute_damping_coefficients_settings["damping_ratio_1"].SetDouble(damping_ratio_1)
  
          # We check if the values are previously defined
          properties = self.main_model_part.GetProperties()
          for prop in properties:
              if prop.Has(SMA.SYSTEM_DAMPING_RATIO):
                  self.settings["damping_ratio_0"].SetDouble(prop.GetValue(SMA.SYSTEM_DAMPING_RATIO))
                  break
          for prop in properties:
              if prop.Has(SMA.SECOND_SYSTEM_DAMPING_RATIO):
                  self.settings["damping_ratio_1"].SetDouble(prop.GetValue(SMA.SECOND_SYSTEM_DAMPING_RATIO))
                  break
  
          # We have computed already the eigen values
          current_process_info = self.main_model_part.ProcessInfo
          precomputed_eigen_values = self.settings["eigen_values_vector"].GetVector()
          if len(precomputed_eigen_values) > 1:
              compute_damping_coefficients_settings["eigen_values_vector"].SetVector(precomputed_eigen_values)
          else:
              # If not computed eigen values already
              if not existing_computation:
                  KM.Logger.PrintInfo("::[MechanicalSolver]::", "EIGENVALUE_VECTOR not previously computed. Computing automatically, take care")
                  eigen_linear_solver = eigen_solver_factory.ConstructSolver(self.settings["eigen_system_settings"])
                  builder_and_solver = KM.ResidualBasedBlockBuilderAndSolver(eigen_linear_solver)
                  eigen_scheme = SMA.EigensolverDynamicScheme()
                  eigen_solver = SMA.EigensolverStrategy(self.main_model_part, eigen_scheme, builder_and_solver,
                      self.mass_matrix_diagonal_value,
                      self.stiffness_matrix_diagonal_value)
                  eigen_solver.Solve()
  
                  # Setting the variable RESET_EQUATION_IDS
                  current_process_info[SMA.RESET_EQUATION_IDS] = True
  
              eigenvalue_vector = current_process_info.GetValue(SMA.EIGENVALUE_VECTOR)
              compute_damping_coefficients_settings["eigen_values_vector"].SetVector(eigenvalue_vector)
  
          # We compute the coefficients
          coefficients_vector = SMA.ComputeDampingCoefficients(compute_damping_coefficients_settings)
  
          # We set the values
          if self.settings["write_on_properties"].GetBool():
              for prop in self.main_model_part.Properties:
                  prop.SetValue(SMA.RAYLEIGH_ALPHA, coefficients_vector[0])
                  if current_process_info.Has(KM.COMPUTE_LUMPED_MASS_MATRIX):
                      if current_process_info[KM.COMPUTE_LUMPED_MASS_MATRIX]:
                          prop.SetValue(SMA.RAYLEIGH_BETA, 0.0)
                      else:
                          prop.SetValue(SMA.RAYLEIGH_BETA, coefficients_vector[1])
                  else:
                      prop.SetValue(SMA.RAYLEIGH_BETA, coefficients_vector[1])
          else:
              current_process_info.SetValue(SMA.RAYLEIGH_ALPHA, coefficients_vector[0])
              if current_process_info.Has(KM.COMPUTE_LUMPED_MASS_MATRIX):
                  if current_process_info[KM.COMPUTE_LUMPED_MASS_MATRIX]:
                      current_process_info.SetValue(SMA.RAYLEIGH_BETA, 0.0)
                  else:
                      current_process_info.SetValue(SMA.RAYLEIGH_BETA, coefficients_vector[1])
              else:
                  current_process_info.SetValue(SMA.RAYLEIGH_BETA, coefficients_vector[1])
function_tokens: def ExecuteBeforeSolutionLoop ( self ) : # The general damping ratios damping_ratio_0 = self . settings [ "damping_ratio_0" ] . GetDouble ( ) damping_ratio_1 = self . settings [ "damping_ratio_1" ] . GetDouble ( ) # We get the model parts which divide the problem current_process_info = self . main_model_part . ProcessInfo existing_computation = current_process_info . Has ( SMA . EIGENVALUE_VECTOR ) # Create auxiliar parameters compute_damping_coefficients_settings = KM . Parameters ( """
          {
              "echo_level"          : 0,
              "damping_ratio_0"     : 0.0,
              "damping_ratio_1"     : -1.0,
              "eigen_values_vector" : [0.0]
          }
          """ ) # Setting custom parameters compute_damping_coefficients_settings [ "echo_level" ] . SetInt ( self . settings [ "echo_level" ] . GetInt ( ) ) compute_damping_coefficients_settings [ "damping_ratio_0" ] . SetDouble ( damping_ratio_0 ) compute_damping_coefficients_settings [ "damping_ratio_1" ] . SetDouble ( damping_ratio_1 ) # We check if the values are previously defined properties = self . main_model_part . GetProperties ( ) for prop in properties : if prop . Has ( SMA . SYSTEM_DAMPING_RATIO ) : self . settings [ "damping_ratio_0" ] . SetDouble ( prop . GetValue ( SMA . SYSTEM_DAMPING_RATIO ) ) break for prop in properties : if prop . Has ( SMA . SECOND_SYSTEM_DAMPING_RATIO ) : self . settings [ "damping_ratio_1" ] . SetDouble ( prop . GetValue ( SMA . SECOND_SYSTEM_DAMPING_RATIO ) ) break # We have computed already the eigen values current_process_info = self . main_model_part . ProcessInfo precomputed_eigen_values = self . settings [ "eigen_values_vector" ] . GetVector ( ) if len ( precomputed_eigen_values ) > 1 : compute_damping_coefficients_settings [ "eigen_values_vector" ] . SetVector ( precomputed_eigen_values ) else : # If not computed eigen values already if not existing_computation : KM . Logger . PrintInfo ( "::[MechanicalSolver]::" , "EIGENVALUE_VECTOR not previously computed. Computing automatically, take care" ) eigen_linear_solver = eigen_solver_factory . ConstructSolver ( self . settings [ "eigen_system_settings" ] ) builder_and_solver = KM . ResidualBasedBlockBuilderAndSolver ( eigen_linear_solver ) eigen_scheme = SMA . EigensolverDynamicScheme ( ) eigen_solver = SMA . EigensolverStrategy ( self . main_model_part , eigen_scheme , builder_and_solver , self . mass_matrix_diagonal_value , self . stiffness_matrix_diagonal_value ) eigen_solver . Solve ( ) # Setting the variable RESET_EQUATION_IDS current_process_info [ SMA . RESET_EQUATION_IDS ] = True eigenvalue_vector = current_process_info . GetValue ( SMA . EIGENVALUE_VECTOR ) compute_damping_coefficients_settings [ "eigen_values_vector" ] . SetVector ( eigenvalue_vector ) # We compute the coefficients coefficients_vector = SMA . ComputeDampingCoefficients ( compute_damping_coefficients_settings ) # We set the values if self . settings [ "write_on_properties" ] . GetBool ( ) : for prop in self . main_model_part . Properties : prop . SetValue ( SMA . RAYLEIGH_ALPHA , coefficients_vector [ 0 ] ) if current_process_info . Has ( KM . COMPUTE_LUMPED_MASS_MATRIX ) : if current_process_info [ KM . COMPUTE_LUMPED_MASS_MATRIX ] : prop . SetValue ( SMA . RAYLEIGH_BETA , 0.0 ) else : prop . SetValue ( SMA . RAYLEIGH_BETA , coefficients_vector [ 1 ] ) else : prop . SetValue ( SMA . RAYLEIGH_BETA , coefficients_vector [ 1 ] ) else : current_process_info . SetValue ( SMA . RAYLEIGH_ALPHA , coefficients_vector [ 0 ] ) if current_process_info . Has ( KM . COMPUTE_LUMPED_MASS_MATRIX ) : if current_process_info [ KM . COMPUTE_LUMPED_MASS_MATRIX ] : current_process_info . SetValue ( SMA . RAYLEIGH_BETA , 0.0 ) else : current_process_info . SetValue ( SMA . RAYLEIGH_BETA , coefficients_vector [ 1 ] ) else : current_process_info . SetValue ( SMA . RAYLEIGH_BETA , coefficients_vector [ 1 ] )