Exemple #1
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 (shouldOutput("system_information", type) && !(type == EXEC_INITIAL && _initialized))
    outputSystemInformation();

  // Write the input
  if (shouldOutput("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)
    writeVariableNorms();

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

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

  // Write the file
  writeStreamToFile();
}
Exemple #2
0
void
Output::outputStep()
{
  // Set output initial related flags, outputting of initial is over at the first call to outputStep
  _on_initial = false;
  _output_initial = false;

  // Only perform output if you should
  if (!shouldOutput())
    return;

  // If the mesh has changed or the sequence state is true or if it has not been called, call the outputSetup() function
  if (_mesh_changed || _sequence || _num == 0 || !_output_setup_called)
  {
    // Execute the setup function
    outputSetup();

    // Reset the _mesh_changed flag
    _mesh_changed = false;

    // outputSetup has been called
    _output_setup_called = true;
  }

  // Update the output number
  _num++;

  // Perform the output
  output();

  // Set the force output flag to false
  _force_output = false;
}
Exemple #3
0
void
Nemesis::output(const ExecFlagType & type)
{
  if (!shouldOutput(type))
    return;

  // Clear the global variables (postprocessors and scalars)
  _global_names.clear();
  _global_values.clear();

  // Call the output methods
  AdvancedOutput::output(type);

  // Set up the whitelist of nodal variable names to write.
  _nemesis_io_ptr->set_output_variables(
      std::vector<std::string>(getNodalVariableOutput().begin(), getNodalVariableOutput().end()));

  // Write nodal data
  _nemesis_io_ptr->write_timestep(
      filename(), *_es_ptr, _nemesis_num, time() + _app.getGlobalTimeOffset());
  _nemesis_initialized = true;

  // Write elemental data
  std::vector<std::string> elemental(getElementalVariableOutput().begin(),
                                     getElementalVariableOutput().end());
  _nemesis_io_ptr->set_output_variables(elemental);
  _nemesis_io_ptr->write_element_data(*_es_ptr);

  // Increment output call counter for the current file
  _nemesis_num++;

  // Write the global variables (populated by the output methods)
  if (!_global_values.empty())
    _nemesis_io_ptr->write_global_data(_global_values, _global_names);
}
Exemple #4
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 (shouldOutput("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");
  }
}
Exemple #5
0
bool
AdvancedOutput<T>::hasOutput(const ExecFlagType & type)
{
  // If any of the component outputs are true, then there is some output to perform
  for (std::map<std::string, MultiMooseEnum>::const_iterator it = T::_advanced_output_on.begin(); it != T::_advanced_output_on.end(); ++it)
    if (shouldOutput(it->first, type))
      return true;

  // There is nothing to output
  return false;
}
Exemple #6
0
void
Console::mooseConsole(const std::string & message)
{
  // Do nothing if output is disabled
  if (!shouldOutput())
    return;

  // Write the messages
  write(message);

  // Flush the stream to the screen
  Moose::out << std::flush;
}
Exemple #7
0
void
Output::outputInitial()
{
  if (shouldOutput())
  {
    outputSetup();
    _mesh_changed = false;
    _output_setup_called = true;
    output();
    _num++;
  }

  // Set the force output flag to false
  _force_output = false;

}
Exemple #8
0
void
AdvancedOutput<T>::output(const ExecFlagType & type)
{
  // Call the various output types, if data exists
  if (shouldOutput("nodal", type))
  {
    outputNodalVariables();
    _last_output_time["nodal"] = T::_time;
  }

  if (shouldOutput("elemental", type))
  {
    outputElementalVariables();
    _last_output_time["elemental"] = T::_time;
  }

  if (shouldOutput("postprocessors", type))
  {
    outputPostprocessors();
    _last_output_time["postprocessors"] = T::_time;
  }

  if (shouldOutput("vector_postprocessors", type))
  {
    outputVectorPostprocessors();
    _last_output_time["vector_postprocessors"] = T::_time;
  }

  if (shouldOutput("scalars", type))
  {
    outputScalarVariables();
    _last_output_time["scalars"] = T::_time;
  }

  if (shouldOutput("system_information", type))
  {
    outputSystemInformation();
    _last_output_time["system_information"] = T::_time;
  }

  if (shouldOutput("input", type))
  {
    outputInput();
    _last_output_time["input"] = T::_time;
  }
}
Exemple #9
0
void
BasicOutput<OversampleOutput>::outputStep(const ExecFlagType & type)
{
  // Force the output
  if (type == EXEC_FORCED)
    output(type);

  // If recovering disable output of initial condition, it was already output
  if (type == EXEC_INITIAL && _app.isRecovering())
    return;

  // Return if the current output is not on the desired interval
  if (type != EXEC_FINAL && !onInterval())
    return;

  // Call the output method (this has the file checking built in b/c OversampleOutput is a FileOutput)
  if (shouldOutput(type))
  {
    updateOversample();
    output(type);
  }
}
Exemple #10
0
void
Console::initialSetup()
{
  // If execute_on = 'initial' perform the output
  if (shouldOutput("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");

  // Output the performance log early
  if (getParam<bool>("setup_log_early"))
    write(Moose::setup_perf_log.get_perf_info());

  // 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.paramSetByUser("postprocessor_execute_on"))
      _advanced_execute_on["postprocessors"].push_back("final");
    if (!_pars.paramSetByUser("scalars_execute_on"))
      _advanced_execute_on["scalars"].push_back("final");
    if (!_pars.paramSetByUser("vector_postprocessor_execute_on"))
      _advanced_execute_on["vector_postprocessors"].push_back("final");
  }
}