<commit_before>/****************************************************************/
/*               DO NOT MODIFY THIS HEADER                      */
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*           (c) 2010 Battelle Energy Alliance, LLC             */
/*                   ALL RIGHTS RESERVED                        */
/*                                                              */
/*          Prepared by Battelle Energy Alliance, LLC           */
/*            Under Contract No. DE-AC07-05ID14517              */
/*            With the U. S. Department of Energy               */
/*                                                              */
/*            See COPYRIGHT for full restrictions               */
/****************************************************************/

#include "GenericExecutionerBlock.h"
#include "AdaptivityBlock.h"
#include "ExecutionerFactory.h"
#include "PetscSupport.h"
#include "Conversion.h"
#include "Moose.h"
#include "Parser.h"

template<>
InputParameters validParams<GenericExecutionerBlock>()
{
  InputParameters params = validParams<ParserBlock>();
  params.addRequiredParam<std::string> ("type", "Specifies the type of Executioner to be used");

  params.addParam<Real>        ("l_tol",           1.0e-5,   "Linear Tolerance");
  params.addParam<Real>        ("l_abs_step_tol",  -1,       "Linear Absolute Step Tolerance");
  params.addParam<unsigned int>("l_max_its",       10000,    "Max Linear Iterations");
  params.addParam<unsigned int>("nl_max_its",      50,       "Max Nonlinear Iterations");
  params.addParam<unsigned int>("nl_max_funcs",    10000,    "Max Nonlinear solver function evaluations");
  params.addParam<Real>        ("nl_abs_tol",      1.0e-50,  "Nonlinear Absolute Tolerance");
  params.addParam<Real>        ("nl_rel_tol",      1.0e-8,   "Nonlinear Relative Tolerance");
  params.addParam<Real>        ("nl_abs_step_tol", 1.0e-50,  "Nonlinear Absolute step Tolerance");
  params.addParam<Real>        ("nl_rel_step_tol", 1.0e-50,  "Nonlinear Relative step Tolerance");
  params.addParam<bool>        ("no_fe_reinit",    false,    "Specifies whether or not to reinitialize FEs");
  params.addParam<bool>        ("perf_log",        false,    "Specifies whether or not the Performance log should be printed");
  params.addParam<bool>        ("auto_scaling",    false,    "Turns on automatic variable scaling");
  params.addParam<std::string> ("scheme",          "backward-euler",  "Time integration scheme used.");

#ifdef LIBMESH_HAVE_PETSC
  params.addParam<std::vector<std::string> >("petsc_options", "Singleton Petsc options");
  params.addParam<std::vector<std::string> >("petsc_options_iname", "Names of Petsc name/value pairs");
  params.addParam<std::vector<std::string> >("petsc_options_value", "Values of Petsc name/value pairs (must correspond with \"petsc_options_iname\"");
#endif //LIBMESH_HAVE_PETSC

  return params;
}

GenericExecutionerBlock::GenericExecutionerBlock(const std::string & name, MooseSystem & moose_system, InputParameters params)
  :ParserBlock(name, moose_system, params),
   _type(getType())
{
  // Register execution prereqs
  addPrereq("Mesh");
  addPrereq("Variables");
  addPrereq("AuxVariables");  
  
  setClassParams(ExecutionerFactory::instance()->getValidParams(_type));
}

void
GenericExecutionerBlock::execute() 
{
  InputParameters class_params = getClassParams();
  class_params.set<THREAD_ID>("_tid") = 0;            // have to set '_tid'

  // Steady and derived Executioners need to know the number of adaptivity steps to take.  This paramter
  // is held in the child block Adaptivity and needs to be pulled early
  ParserBlock *adaptivity_block = locateBlock("Executioner/Adaptivity");
  if (adaptivity_block != NULL)
  {
    AdaptivityBlock *a = dynamic_cast<AdaptivityBlock *>(adaptivity_block);
    class_params.set<unsigned int>("steps") = a->getSteps();
  }
  
  _moose_system.initExecutioner(ExecutionerFactory::instance()->build(_type, "Executioner", _moose_system, class_params));
  
  EquationSystems *es = _moose_system.getEquationSystems();
  es->parameters.set<Real> ("linear solver tolerance")
    = getParamValue<Real>("l_tol");

  es->parameters.set<Real> ("linear solver absolute step tolerance")<commit_msg>Fixing big oops!<commit_after>/****************************************************************/
/*               DO NOT MODIFY THIS HEADER                      */
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*           (c) 2010 Battelle Energy Alliance, LLC             */
/*                   ALL RIGHTS RESERVED                        */
/*                                                              */
/*          Prepared by Battelle Energy Alliance, LLC           */
/*            Under Contract No. DE-AC07-05ID14517              */
/*            With the U. S. Department of Energy               */
/*                                                              */
/*            See COPYRIGHT for full restrictions               */
/****************************************************************/

#include "GenericExecutionerBlock.h"
#include "AdaptivityBlock.h"
#include "ExecutionerFactory.h"
#include "PetscSupport.h"
#include "Conversion.h"
#include "Moose.h"
#include "Parser.h"

template<>
InputParameters validParams<GenericExecutionerBlock>()
{
  InputParameters params = validParams<ParserBlock>();
  params.addRequiredParam<std::string> ("type", "Specifies the type of Executioner to be used");

  params.addParam<Real>        ("l_tol",           1.0e-5,   "Linear Tolerance");
  params.addParam<Real>        ("l_abs_step_tol",  -1,       "Linear Absolute Step Tolerance");
  params.addParam<unsigned int>("l_max_its",       10000,    "Max Linear Iterations");
  params.addParam<unsigned int>("nl_max_its",      50,       "Max Nonlinear Iterations");
  params.addParam<unsigned int>("nl_max_funcs",    10000,    "Max Nonlinear solver function evaluations");
  params.addParam<Real>        ("nl_abs_tol",      1.0e-50,  "Nonlinear Absolute Tolerance");
  params.addParam<Real>        ("nl_rel_tol",      1.0e-8,   "Nonlinear Relative Tolerance");
  params.addParam<Real>        ("nl_abs_step_tol", 1.0e-50,  "Nonlinear Absolute step Tolerance");
  params.addParam<Real>        ("nl_rel_step_tol", 1.0e-50,  "Nonlinear Relative step Tolerance");
  params.addParam<bool>        ("no_fe_reinit",    false,    "Specifies whether or not to reinitialize FEs");
  params.addParam<bool>        ("perf_log",        false,    "Specifies whether or not the Performance log should be printed");
  params.addParam<bool>        ("auto_scaling",    false,    "Turns on automatic variable scaling");
  params.addParam<std::string> ("scheme",          "backward-euler",  "Time integration scheme used.");

#ifdef LIBMESH_HAVE_PETSC
  params.addParam<std::vector<std::string> >("petsc_options", "Singleton Petsc options");
  params.addParam<std::vector<std::string> >("petsc_options_iname", "Names of Petsc name/value pairs");
  params.addParam<std::vector<std::string> >("petsc_options_value", "Values of Petsc name/value pairs (must correspond with \"petsc_options_iname\"");
#endif //LIBMESH_HAVE_PETSC

  return params;
}

GenericExecutionerBlock::GenericExecutionerBlock(const std::string & name, MooseSystem & moose_system, InputParameters params)
  :ParserBlock(name, moose_system, params),
   _type(getType())
{
  // Register execution prereqs
  addPrereq("Mesh");
  addPrereq("Variables");
  addPrereq("AuxVariables");  
  
  setClassParams(ExecutionerFactory::instance()->getValidParams(_type));
}

void
GenericExecutionerBlock::execute() 
{
  InputParameters class_params = getClassParams();
  class_params.set<THREAD_ID>("_tid") = 0;            // have to set '_tid'

  // Steady and derived Executioners need to know the number of adaptivity steps to take.  This paramter
  // is held in the child block Adaptivity and needs to be pulled early
  ParserBlock *adaptivity_block = locateBlock("Executioner/Adaptivity");
  if (adaptivity_block != NULL)
  {
    AdaptivityBlock *a = dynamic_cast<AdaptivityBlock *>(adaptivity_block);
    class_params.set<unsigned int>("steps") = a->getSteps();
  }
  else
    class_params.set<unsigned int>("steps") = 0;
  
  _moose_system.initExecutioner(ExecutionerFactory::instance()->build(_type, "Executioner", _moose_system, class_params));
  
  EquationSystems *es = _moose_system.getEquationSystems();
  es->parameters.set<Real> ("linear solver tolerance")
    = getParamValue<Real>("l_tol");

  es->parameters.set<Real> ("linear solver absolute step tolerance")
{'fraction_non_alphanumeric': 0.14753911156788854, 'fraction_numerical': 0.010391686650679457, 'mean_word_length': 3.026666666666667, 'pattern_counts': {'":': 0, '<': 62, '<?xml version=': 0, '>': 72, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2550403', 'n_tokens_mistral': 2558, 'n_tokens_neox': 2431, 'n_words': 579}