Beispiel #1
0
void
Console::initialSetup()
{
  // If --timing was used from the command-line, do nothing, all logs are enabled
  // Also, only allow the main app to change the perf_log settings.
  if (!_timing && _app.name() == "main")
  {
    if (_perf_log || _setup_log || _solve_log || _perf_header || _setup_log_early)
      _app.getOutputWarehouse().setLoggingRequested();

    // Disable performance logging if nobody needs logging
    if (!_app.getOutputWarehouse().getLoggingRequested())
      Moose::perf_log.disable_logging();

    // Disable libMesh log
    if (!_libmesh_log)
      libMesh::perflog.disable_logging();
  }

  // system info flag can be changed only before console initial setup
  _allow_changing_sysinfo_flag = false;

  // If execute_on = 'initial' perform the output
  if (wantOutput("system_information", EXEC_INITIAL))
    outputSystemInformation();

  // Call the base class method
  TableOutput::initialSetup();

  // If file output is desired, wipe out the existing file if not recovering
  if (!_app.isRecovering())
    writeStreamToFile(false);

  // Enable verbose output if Executioner has it enabled
  if (_app.getExecutioner()->isParamValid("verbose") &&
      _app.getExecutioner()->getParam<bool>("verbose"))
    _verbose = true;

  // Display a message to indicate the application is running (useful for MultiApps)
  if (_problem_ptr->hasMultiApps() || _app.multiAppLevel() > 0)
    write(std::string("\nRunning App: ") + _app.name() + "\n");

  // If the user adds "final" to the execute on, append this to the postprocessors, scalars, etc.,
  // but only
  // if the parameter (e.g., postprocessor_execute_on) has not been modified by the user.
  if (_execute_on.contains("final"))
  {
    if (!_pars.isParamSetByUser("postprocessor_execute_on"))
      _advanced_execute_on["postprocessors"].push_back("final");
    if (!_pars.isParamSetByUser("scalars_execute_on"))
      _advanced_execute_on["scalars"].push_back("final");
    if (!_pars.isParamSetByUser("vector_postprocessor_execute_on"))
      _advanced_execute_on["vector_postprocessors"].push_back("final");
  }
}
Beispiel #2
0
void
Console::output(const ExecFlagType & type)
{
  // Return if the current output is not on the desired interval
  if (type != EXEC_FINAL && !onInterval())
    return;

  // Output the system information first; this forces this to be the first item to write by default
  // However, 'output_system_information_on' still operates correctly, so it may be changed by the
  // user
  if (wantOutput("system_information", type) && !(type == EXEC_INITIAL && _initialized))
    outputSystemInformation();

  // Write the input
  if (wantOutput("input", type))
    outputInput();

  // Write the timestep information ("Time Step 0 ..."), this is controlled with "execute_on"
  if (type == EXEC_TIMESTEP_BEGIN || (type == EXEC_INITIAL && _execute_on.contains(EXEC_INITIAL)) ||
      (type == EXEC_FINAL && _execute_on.contains(EXEC_FINAL)))
    writeTimestepInformation();

  // Print Non-linear Residual (control with "execute_on")
  if (type == EXEC_NONLINEAR && _execute_on.contains(EXEC_NONLINEAR))
  {
    if (_nonlinear_iter == 0)
      _old_nonlinear_norm = std::numeric_limits<Real>::max();

    _console << std::setw(2) << _nonlinear_iter
             << " Nonlinear |R| = " << outputNorm(_old_nonlinear_norm, _norm) << '\n';

    _old_nonlinear_norm = _norm;
  }

  // Print Linear Residual (control with "execute_on")
  else if (type == EXEC_LINEAR && _execute_on.contains(EXEC_LINEAR))
  {
    if (_linear_iter == 0)
      _old_linear_norm = std::numeric_limits<Real>::max();

    _console << std::setw(7) << _linear_iter
             << " Linear |R| = " << outputNorm(_old_linear_norm, _norm) << '\n';

    _old_linear_norm = _norm;
  }

  // Write variable norms
  else if (type == EXEC_TIMESTEP_END)
  {
    if (_perf_log_interval && _t_step % _perf_log_interval == 0)
      write(Moose::perf_log.get_perf_info(), false);
    writeVariableNorms();
  }

  // Write Postprocessors and Scalars
  if (wantOutput("postprocessors", type))
    outputPostprocessors();

  if (wantOutput("scalars", type))
    outputScalarVariables();

  // Write the file
  writeStreamToFile();
}