Ejemplo n.º 1
0
std::string
outputOutputInformation(MooseApp & app)
{
  std::stringstream oss;
  oss << std::left;

  const std::vector<Output *> outputs = app.getOutputWarehouse().getOutputs<Output>();
  oss << "Outputs:\n";
  for (std::vector<Output *>::const_iterator it = outputs.begin(); it != outputs.end(); ++it)
  {
    // Display the "execute_on" settings
    const MultiMooseEnum & execute_on = (*it)->executeOn();
    oss << "  " << std::setw(console_field_width-2) << (*it)->name() <<  "\"" << execute_on << "\"\n";

    // Display the advanced "execute_on" settings, only if they are different from "execute_on"
    if ((*it)->isAdvanced())
    {
      const OutputOnWarehouse & adv_on = (*it)->advancedExecuteOn();
      for (std::map<std::string, MultiMooseEnum>::const_iterator adv_it = adv_on.begin(); adv_it != adv_on.end(); ++adv_it)
        if (execute_on != adv_it->second)
          oss << "    " << std::setw(console_field_width-4) << adv_it->first + ":" <<  "\"" << adv_it->second << "\"\n";
    }
  }

  return oss.str();
}
Ejemplo n.º 2
0
void
TransientMultiApp::setupApp(unsigned int i, Real /*time*/)  // FIXME: Should we be passing time?
{
  MooseApp * app = _apps[i];
  Transient * ex = dynamic_cast<Transient *>(app->getExecutioner());
  if (!ex)
    mooseError("MultiApp " << name() << " is not using a Transient Executioner!");

  // Get the FEProblemBase for the current MultiApp
  FEProblemBase & problem = appProblemBase(_first_local_app + i);

  // Update the file numbers for the outputs from the parent application
  app->getOutputWarehouse().setFileNumbers(_app.getOutputFileNumbers());

  // Call initialization method of Executioner (Note, this preforms the output of the initial time step, if desired)
  ex->init();

  if (_interpolate_transfers)
  {
    AuxiliarySystem & aux_system = problem.getAuxiliarySystem();
    System & libmesh_aux_system = aux_system.system();

    // We'll store a copy of the auxiliary system's solution at the old time in here
    libmesh_aux_system.add_vector("transfer_old", false);

    // This will be where we'll transfer the value to for the "target" time
    libmesh_aux_system.add_vector("transfer", false);
  }

  ex->preExecute();
  problem.advanceState();
  _transient_executioners[i] = ex;
}
Ejemplo n.º 3
0
void
MultiApp::createApp(unsigned int i, Real start_time)
{

  // Define the app name
  std::ostringstream multiapp_name;
  std::string full_name;
  multiapp_name << _name <<  std::setw(std::ceil(std::log10(_total_num_apps)))
           << std::setprecision(0) << std::setfill('0') << std::right << _first_local_app + i;

  // Only add parent name if it the parent is not the main app
  if (_app.getOutputWarehouse().multiappLevel() > 0)
    full_name = _app.name() + "_" + multiapp_name.str();
  else
    full_name = multiapp_name.str();

  InputParameters app_params = AppFactory::instance().getValidParams(_app_type);
  app_params.set<FEProblem *>("_parent_fep") = _fe_problem;
  app_params.set<MooseSharedPointer<CommandLine> >("_command_line") = _app.commandLine();
  MooseApp * app = AppFactory::instance().create(_app_type, full_name, app_params, _my_comm);
  _apps[i] = app;

  std::string input_file = "";
  if (_input_files.size() == 1) // If only one input file was provided, use it for all the solves
    input_file = _input_files[0];
  else
    input_file = _input_files[_first_local_app+i];

  std::ostringstream output_base;

  // Create an output base by taking the output base of the master problem and appending
  // the name of the multiapp + a number to it
  if (!_app.getOutputFileBase().empty())
    output_base << _app.getOutputFileBase() + "_";
  else
  {
    std::string base = _app.getFileName();
    size_t pos = base.find_last_of('.');
    output_base << base.substr(0, pos) + "_out_";
  }

  // Append the sub app name to the output file base
  output_base << multiapp_name.str();
  app->setGlobalTimeOffset(start_time);
  app->setInputFileName(input_file);
  app->setOutputFileBase(output_base.str());
  app->setOutputFileNumbers(_app.getOutputWarehouse().getFileNumbers());

  if (getParam<bool>("output_in_position"))
    app->setOutputPosition(_app.getOutputPosition() + _positions[_first_local_app + i]);

  // Update the MultiApp level for the app that was just created
  app->getOutputWarehouse().multiappLevel() = _app.getOutputWarehouse().multiappLevel() + 1;
  app->setupOptions();
  app->runInputFile();
}
Ejemplo n.º 4
0
void
initPostprocessorOrVectorPostprocessorLists(OutputData & output_data, warehouse_type & warehouse, bool & has_limited_pps, MooseApp & app, std::string & name, InputParameters & params)
{
  // Loop through each of the execution flags
  for (unsigned int i = 0; i < Moose::exec_types.size(); i++)
  {
    // Loop through each of the postprocessors
    for (typename std::vector<postprocessor_type *>::const_iterator postprocessor_it = warehouse(Moose::exec_types[i])[0].all().begin();
         postprocessor_it != warehouse(Moose::exec_types[i])[0].all().end();
         ++postprocessor_it)
    {
      // Store the name in the available postprocessors
      postprocessor_type *pps = *postprocessor_it;
      output_data.available.push_back(pps->PPName());

      // Extract the list of outputs
      std::set<OutputName> pps_outputs = pps->getOutputs();

      // Check that the outputs are valid
      app.getOutputWarehouse().checkOutputs(pps_outputs);

      /* Hide the postprocessor if:
       *  (1) The "outputs" parameter is NOT empty and
       *  (2) 'all' is NOT found in the 'outputs' parameter and
       *  (3) 'none' is used within the 'outputs' parameter or
       *  (4) this output object name is not found in the list of output names
       */
      if ( !pps_outputs.empty() && pps_outputs.find("all") == pps_outputs.end() &&
           (pps_outputs.find("none") != pps_outputs.end() || pps_outputs.find(name) == pps_outputs.end()) )
        output_data.hide.push_back(pps->PPName());

      // Check that the output object allows postprocessor output, account for "all" keyword (if it is present assume "all" was desired)
      if ( pps_outputs.find(name) != pps_outputs.end() || pps_outputs.find("all") != pps_outputs.end() )
      {
        if (!params.isParamValid("output_postprocessors"))
          mooseWarning("Postprocessor '" << pps->PPName()
                       << "' has requested to be output by the '" << name
                       << "' output, but postprocessor output is not support by this type of output object.");
      }

      // Set the flag state for postprocessors that utilize 'outputs' parameter
      if (!pps_outputs.empty() && pps_outputs.find("all") == pps_outputs.end())
        has_limited_pps = true;
    }
  }
}