Exemple #1
0
Transient::Transient(const InputParameters & parameters) :
    Executioner(parameters),
    _problem(_fe_problem),
    _time_scheme(getParam<MooseEnum>("scheme")),
    _t_step(_problem.timeStep()),
    _time(_problem.time()),
    _time_old(_problem.timeOld()),
    _dt(_problem.dt()),
    _dt_old(_problem.dtOld()),
    _unconstrained_dt(declareRecoverableData<Real>("unconstrained_dt", -1)),
    _at_sync_point(declareRecoverableData<bool>("at_sync_point", false)),
    _first(declareRecoverableData<bool>("first", true)),
    _multiapps_converged(declareRecoverableData<bool>("multiapps_converged", true)),
    _last_solve_converged(declareRecoverableData<bool>("last_solve_converged", true)),
    _end_time(getParam<Real>("end_time")),
    _dtmin(getParam<Real>("dtmin")),
    _dtmax(getParam<Real>("dtmax")),
    _num_steps(getParam<unsigned int>("num_steps")),
    _n_startup_steps(getParam<int>("n_startup_steps")),
    _steps_taken(0),
    _trans_ss_check(getParam<bool>("trans_ss_check")),
    _ss_check_tol(getParam<Real>("ss_check_tol")),
    _ss_tmin(getParam<Real>("ss_tmin")),
    _old_time_solution_norm(declareRecoverableData<Real>("old_time_solution_norm", 0.0)),
    _sync_times(_app.getOutputWarehouse().getSyncTimes()),
    _abort(getParam<bool>("abort_on_solve_fail")),
    _time_interval(declareRecoverableData<bool>("time_interval", false)),
    _start_time(getParam<Real>("start_time")),
    _timestep_tolerance(getParam<Real>("timestep_tolerance")),
    _target_time(declareRecoverableData<Real>("target_time", -1)),
    _use_multiapp_dt(getParam<bool>("use_multiapp_dt")),
    _picard_it(declareRecoverableData<int>("picard_it", 0)),
    _picard_max_its(getParam<unsigned int>("picard_max_its")),
    _picard_converged(declareRecoverableData<bool>("picard_converged", false)),
    _picard_initial_norm(declareRecoverableData<Real>("picard_initial_norm", 0.0)),
    _picard_timestep_begin_norm(declareRecoverableData<Real>("picard_timestep_begin_norm", 0.0)),
    _picard_timestep_end_norm(declareRecoverableData<Real>("picard_timestep_end_norm", 0.0)),
    _picard_rel_tol(getParam<Real>("picard_rel_tol")),
    _picard_abs_tol(getParam<Real>("picard_abs_tol")),
    _verbose(getParam<bool>("verbose"))
{
  _problem.getNonlinearSystem().setDecomposition(_splitting);
  _t_step = 0;
  _dt = 0;
  _next_interval_output_time = 0.0;

  // Either a start_time has been forced on us, or we want to tell the App about what our start time is (in case anyone else is interested.
  if (_app.hasStartTime())
    _start_time = _app.getStartTime();
  else if (parameters.paramSetByUser("start_time"))
    _app.setStartTime(_start_time);

  _time = _time_old = _start_time;
  _problem.transient(true);

  if (!_restart_file_base.empty())
    _problem.setRestartFile(_restart_file_base);

  setupTimeIntegrator();

  if (_app.halfTransient()) // Cut timesteps and end_time in half...
  {
    _end_time /= 2.0;
    _num_steps /= 2.0;

    if (_num_steps == 0) // Always do one step in the first half
      _num_steps = 1;
  }
}
Exemple #2
0
Console::Console(const InputParameters & parameters) :
    TableOutput(parameters),
    _max_rows(getParam<unsigned int>("max_rows")),
    _fit_mode(getParam<MooseEnum>("fit_mode")),
    _scientific_time(getParam<bool>("scientific_time")),
    _write_file(getParam<bool>("output_file")),
    _write_screen(getParam<bool>("output_screen")),
    _verbose(getParam<bool>("verbose")),
    _perf_log(getParam<bool>("perf_log")),
    _solve_log(isParamValid("solve_log") ? getParam<bool>("solve_log") : _perf_log),
    _setup_log(isParamValid("setup_log") ? getParam<bool>("setup_log") : _perf_log),
#ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
    _libmesh_log(getParam<bool>("libmesh_log")),
#endif
    _setup_log_early(getParam<bool>("setup_log_early")),
    _perf_header(isParamValid("perf_header") ? getParam<bool>("perf_header") : _perf_log),
    _all_variable_norms(getParam<bool>("all_variable_norms")),
    _outlier_variable_norms(getParam<bool>("outlier_variable_norms")),
    _outlier_multiplier(getParam<std::vector<Real> >("outlier_multiplier")),
    _precision(isParamValid("time_precision") ? getParam<unsigned int>("time_precision") : 0),
    _timing(_app.getParam<bool>("timing")),
    _console_buffer(_app.getOutputWarehouse().consoleBuffer()),
    _old_linear_norm(std::numeric_limits<Real>::max()),
    _old_nonlinear_norm(std::numeric_limits<Real>::max()),
    _print_mesh_changed_info(getParam<bool>("print_mesh_changed_info")),
    _system_info_flags(getParam<MultiMooseEnum>("system_info"))

{
  // Apply the special common console flags (print_...)
  ActionWarehouse & awh = _app.actionWarehouse();
  Action * common_action = awh.getActionsByName("common_output")[0];

  // Honor the 'print_linear_residuals' option, only if 'execute_on' has not been set by the user
  if (!parameters.paramSetByUser("execute_on"))
  {
    if (common_action->getParam<bool>("print_linear_residuals"))
      _execute_on.push_back("linear");
    else
      _execute_on.erase("linear");
  }

  if (!_pars.paramSetByUser("perf_log") && common_action->getParam<bool>("print_perf_log"))
  {
    _perf_log = true;
    _solve_log = true;
    _setup_log = true;
  }

  // Append the common 'execute_on' to the setting for this object
  // This is unique to the Console object, all other objects inherit from the common options
  const MultiMooseEnum & common_execute_on = common_action->getParam<MultiMooseEnum>("execute_on");
  for (MooseEnumIterator it = common_execute_on.begin(); it != common_execute_on.end(); ++it)
    _execute_on.push_back(*it);

  // If --timing was used from the command-line, do nothing, all logs are enabled
  if (!_timing)
  {
    // Disable performance logging (all log input options must be false)
    if (!_perf_log && !_setup_log && !_solve_log && !_perf_header && !_setup_log_early)
    {
      Moose::perf_log.disable_logging();
      Moose::setup_perf_log.disable_logging();
    }

    // Disable libMesh log
#ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
    if (!_libmesh_log)
      libMesh::perflog.disable_logging();
#endif
  }

  // If --show-outputs is used, enable it
  if (_app.getParam<bool>("show_outputs"))
    _system_info_flags.push_back("output");

  // Set output coloring
  if (Moose::_color_console)
  {
    char * term_env = getenv("TERM");
    if (term_env)
    {
      std::string term(term_env);
      if (term != "xterm-256color" && term != "xterm")
        Moose::_color_console = false;
    }
  }
}