void
ContactPressureAuxAction::act()
{
  if (!_problem->getDisplacedProblem())
  {
    mooseError("Contact requires updated coordinates.  Use the 'displacements = ...' line in the Mesh block.");
  }

  {
    InputParameters params = _factory.getValidParams("ContactPressureAux");

    // Extract global params
    if (isParamValid("parser_syntax"))
      _app.parser().extractParams(getParam<std::string>("parser_syntax"), params);

    params.set<std::vector<BoundaryName> >("boundary") = std::vector<BoundaryName>(1,_slave);
    params.set<BoundaryName>("paired_boundary") = _master;
    params.set<AuxVariableName>("variable") = "contact_pressure";
    params.addRequiredCoupledVar("nodal_area", "The nodal area");
    params.set<std::vector<VariableName> >("nodal_area") = std::vector<VariableName>(1, "nodal_area_"+_name);
    params.set<MooseEnum>("order") = _order;

    params.set<bool>("use_displaced_mesh") = true;

    std::stringstream name;
    name << _name;
    name << "_contact_pressure_";
    name << counter++;

    MultiMooseEnum execute_options(SetupInterface::getExecuteOptions());
    execute_options = "nonlinear timestep_end timestep_begin";
    params.set<MultiMooseEnum>("execute_on") = execute_options;
    _problem->addAuxKernel("ContactPressureAux", name.str(), params);
  }
}
void
AddNodalNormalsAction::act()
{
  // Set the order from the input
  Order order = Utility::string_to_enum<Order>(getParam<MooseEnum>("order"));
  FEFamily family = LAGRANGE;
  FEType fe_type(order, family);

  // Add 3 aux variables for each component of the normal
  if (_current_task == "add_aux_variable")
  {
    _problem->addAuxVariable("nodal_normal_x", fe_type);
    _problem->addAuxVariable("nodal_normal_y", fe_type);
    _problem->addAuxVariable("nodal_normal_z", fe_type);
  }

  // Set the execute options
  MultiMooseEnum execute_options(SetupInterface::getExecuteOptions());
  execute_options = "initial timestep_begin";

  // Create the NodalNormalsPreprocessor UserObject
  if (_current_task == "add_postprocessor")
  {
    InputParameters pars = _factory.getValidParams("NodalNormalsPreprocessor");
    pars.set<Order>("fe_order") = order;
    pars.set<FEFamily>("fe_family") = family;
    pars.set<MultiMooseEnum>("execute_on") = execute_options;
    pars.set<std::vector<BoundaryName> >("boundary") = _boundary;

    if (_has_corners)
      pars.set<BoundaryName>("corner_boundary") = _corner_boundary;

    _problem->addUserObject("NodalNormalsPreprocessor", "nodal_normals_preprocessor", pars);
  }

  if (_current_task == "add_user_object")
  {
    /// Create the NodalNormalsCorner UserObject (only if corner boundary is given)
    if (_has_corners)
    {
      InputParameters pars = _factory.getValidParams("NodalNormalsCorner");
      pars.set<MultiMooseEnum>("execute_on") = execute_options;
      pars.set<std::vector<BoundaryName> >("boundary") = _boundary;
      pars.set<BoundaryName>("corner_boundary") = _corner_boundary;
      _problem->addUserObject("NodalNormalsCorner", "nodal_normals_corner", pars);
    }

    /// Create the NodalNormalsEvaluator UserObject
    {
      InputParameters pars = _factory.getValidParams("NodalNormalsEvaluator");
      pars.set<MultiMooseEnum>("execute_on") = execute_options;
      pars.set<std::vector<BoundaryName> >("boundary") = _boundary;
      _problem->addUserObject("NodalNormalsEvaluator", "nodal_normals_evaluator", pars);
    }
  }
}
示例#3
0
void
EigenExecutionerBase::addRealParameterReporter(const std::string & param_name)
{
  InputParameters params = _app.getFactory().getValidParams("ProblemRealParameter");
  MooseEnum execute_options(SetupInterface::getExecuteOptions());
  execute_options = "timestep";
  params.set<MooseEnum>("execute_on") = execute_options;
  params.set<std::string>("param_name") = param_name;
  _problem.addPostprocessor("ProblemRealParameter", param_name, params);
}
示例#4
0
InputParameters validParams<SetupInterface>()
{
  InputParameters params = emptyInputParameters();

  // Get an MooseEnum of the avaible 'execute_on' options
  MultiMooseEnum execute_options(SetupInterface::getExecuteOptions());

  // Add the 'execute_on' input parameter for users to set
  params.addParam<MultiMooseEnum>("execute_on", execute_options, "Set to (residual|jacobian|timestep|timestep_begin|custom) to execute only at that moment");

  return params;
}
示例#5
0
文件: MultiApp.C 项目: vpeter15/moose
InputParameters validParams<MultiApp>()
{
  InputParameters params = validParams<MooseObject>();

  params.addParam<bool>("use_displaced_mesh", false, "Whether or not this object should use the displaced mesh for computation.  Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.");
  params.addParamNamesToGroup("use_displaced_mesh", "Advanced");

  std::ostringstream app_types_strings;

  registeredMooseAppIterator it = AppFactory::instance().registeredObjectsBegin();
  while (it != AppFactory::instance().registeredObjectsEnd())
  {
    app_types_strings << it->first;
    ++it;
    if (it != AppFactory::instance().registeredObjectsEnd())
      app_types_strings<< ", ";
  }

  MooseEnum app_types_options(app_types_strings.str());

  params.addRequiredParam<MooseEnum>("app_type", app_types_options, "The type of application to build.");
  params.addParam<std::vector<Point> >("positions", "The positions of the App locations.  Each set of 3 values will represent a Point.  Either this must be supplied or 'positions_file'");
  params.addParam<FileName>("positions_file", "A filename that should be looked in for positions. Each set of 3 values in that file will represent a Point.  Either this must be supplied or 'positions'");

  params.addRequiredParam<std::vector<std::string> >("input_files", "The input file for each App.  If this parameter only contains one input file it will be used for all of the Apps.");
  params.addParam<Real>("bounding_box_inflation", 0.01, "Relative amount to 'inflate' the bounding box of this MultiApp.");

  params.addPrivateParam<MPI_Comm>("_mpi_comm");


  MultiMooseEnum execute_options(SetupInterface::getExecuteOptions());
  execute_options = "timestep_begin";  // set the default

  params.addParam<MultiMooseEnum>("execute_on", execute_options, "Set to (linear|nonlinear|timestep_end|timestep_begin|custom) to execute only at that moment");

  params.addParam<unsigned int>("max_procs_per_app", std::numeric_limits<unsigned int>::max(), "Maximum number of processors to give to each App in this MultiApp.  Useful for restricting small solves to just a few procs so they don't get spread out");

  params.addParam<bool>("output_in_position", false, "If true this will cause the output from the MultiApp to be 'moved' by its position vector");

  params.addParam<Real>("reset_time", std::numeric_limits<Real>::max(), "The time at which to reset Apps given by the 'reset_apps' parameter.  Resetting an App means that it is destroyed and recreated, possibly modeling the insertion of 'new' material for that app.");

  params.addParam<std::vector<unsigned int> >("reset_apps", "The Apps that will be reset when 'reset_time' is hit.  These are the App 'numbers' starting with 0 corresponding to the order of the App positions.  Resetting an App means that it is destroyed and recreated, possibly modeling the insertion of 'new' material for that app.");

  params.addParam<Real>("move_time", std::numeric_limits<Real>::max(), "The time at which Apps designated by move_apps are moved to move_positions.");

  params.addParam<std::vector<unsigned int> >("move_apps", "Apps, designated by their 'numbers' starting with 0 corresponding to the order of the App positions, to be moved at move_time to move_positions");

  params.addParam<std::vector<Point> >("move_positions", "The positions corresponding to each move_app.");

  params.registerBase("MultiApp");

  return params;
}
示例#6
0
InputParameters validParams<MaterialCopyUserObject>()
{
  InputParameters params = validParams<GeneralUserObject>();
  params.addRequiredParam<std::vector<Real> >("copy_times", "Times at which state should be copied");
  params.addRequiredParam<unsigned int>("copy_from_element", "The id of the element from which data is copied");
  params.addRequiredParam<unsigned int>("copy_to_element", "The id of the element to which data is copied");

  MultiMooseEnum execute_options(SetupInterface::getExecuteOptions());
  execute_options = "timestep_end";
  params.set<MultiMooseEnum>("execute_on") = execute_options;

  return params;
}
示例#7
0
InputParameters validParams<FeatureFloodCountAux>()
{
  InputParameters params = validParams<AuxKernel>();
  params.addClassDescription("Feature detection by connectivity analysis");
  params.addDeprecatedParam<UserObjectName>("bubble_object", "The FeatureFloodCount UserObject to get values from.", "Use \"flood_counter\" instead.");
  params.addRequiredParam<UserObjectName>("flood_counter", "The FeatureFloodCount UserObject to get values from.");
  params.addParam<unsigned int>("map_index", "The index of which map to retrieve values from when using FeatureFloodCount with multiple maps.");
  MooseEnum field_display("UNIQUE_REGION VARIABLE_COLORING GHOSTED_ENTITIES HALOS CENTROID ACTIVE_BOUNDS", "UNIQUE_REGION");
  params.addParam<MooseEnum>("field_display", field_display, "Determines how the auxilary field should be colored. (UNIQUE_REGION and VARIABLE_COLORING are nodal, CENTROID is elemental, default: UNIQUE_REGION)");

  MultiMooseEnum execute_options(SetupInterface::getExecuteOptions());
  execute_options = "initial timestep_end";
  params.set<MultiMooseEnum>("execute_on") = execute_options;

  return params;
}
InputParameters validParams<NucleationLocationUserObject>()
{
  InputParameters params = validParams<ElementUserObject>();

  params.addRequiredCoupledVar("coupled_aux_vars", "coupled elemental auxiliary variables");
  params.addRequiredParam<int>("n_coupled_aux", "# of coupled aux variables");
  params.addRequiredParam<Real>("dwell_time", "How long nucleation event is");

  MultiMooseEnum execute_options(SetupInterface::getExecuteOptions());
  execute_options = "timestep_begin";
  params.set<MultiMooseEnum>("execute_on") = execute_options;

  params.addRequiredParam<int>("num_orientations", "# of orientation variants");
  params.addParam<Real>("boundary_width", 0.0, "the distance from mesh boundary to not nucleate");
  params.addParam<int>("random_seed", 0.0, "the random number seed for Bernoulli trial");

  return params;
}
示例#9
0
void
ContactPressureAuxAction::act()
{
  if (!_problem->getDisplacedProblem())
  {
    mooseError("Contact requires updated coordinates.  Use the 'displacements = ...' line in the Mesh block.");
  }

  std::string short_name(_name);
  // Chop off "Contact/"
  short_name.erase(0, 8);

  {
    InputParameters params = _factory.getValidParams("ContactPressureAux");

    // Extract global params
    _app.parser().extractParams(_name, params);

    params.set<std::vector<BoundaryName> >("boundary") = std::vector<BoundaryName>(1,_slave);
    params.set<BoundaryName>("paired_boundary") = _master;
    params.set<AuxVariableName>("variable") = "contact_pressure";
    params.addRequiredCoupledVar("nodal_area", "The nodal area");
    params.set<std::vector<VariableName> >("nodal_area") = std::vector<VariableName>(1, "nodal_area_"+short_name);
    params.set<MooseEnum>("order") = _order;

    params.set<bool>("use_displaced_mesh") = true;

    std::stringstream name;
    name << short_name;
    name << "_contact_pressure_";
    name << counter++;

    std::vector<MooseEnum> execute_options(3, SetupInterface::getExecuteOptions()[0]);
    execute_options[0] = "jacobian";
    execute_options[1] = "timestep";
    execute_options[2] = "timestep_begin";
    params.set<std::vector<MooseEnum> >("execute_on") = execute_options;
    _problem->addAuxKernel("ContactPressureAux", name.str(), params);
  }
}
void
CHPFCRFFSplitVariablesAction::act()
{
  MultiMooseEnum execute_options(SetupInterface::getExecuteOptions());
  execute_options = "timestep_begin";

  // Setup MultiApp
  InputParameters poly_params = _factory.getValidParams("TransientMultiApp");
  poly_params.set<MooseEnum>("app_type") = "PhaseFieldApp";
  poly_params.set<MultiMooseEnum>("execute_on") = execute_options;
  poly_params.set<std::vector<std::string> >("input_files") = _sub_filenames;
  poly_params.set<unsigned int>("max_procs_per_app") = 1;

  Point one(0.0, 0.0, 0.0);

  std::vector<Point > positions;
  positions.push_back(one);

  poly_params.set<std::vector<Point> >("positions") = positions;

  _problem->addMultiApp("TransientMultiApp", "HHEquationSolver", poly_params);

  poly_params = _factory.getValidParams("MultiAppNearestNodeTransfer");
  poly_params.set<MooseEnum>("direction") = "to_multiapp";
  poly_params.set<MultiMooseEnum>("execute_on") = execute_options;
  poly_params.set<AuxVariableName>("variable") = _n_name;
  poly_params.set<VariableName>("source_variable") = _n_name;
  poly_params.set<MultiAppName>("multi_app") = "HHEquationSolver";


  // Create Name for Transfer
  std::string trans_name = _n_name;
  trans_name.append("_trans");

  _problem->addTransfer("MultiAppNearestNodeTransfer", trans_name, poly_params);

#ifdef DEBUG
  Moose::err << "Inside the CHPFCRFFSplitVariablesAction Object\n";
  Moose::err << "VariableBase: " << _L_name_base
            << "\torder: " << getParam<MooseEnum>("order")
            << "\tfamily: " << getParam<MooseEnum>("family") << std::endl;
#endif

  // Loop through the number of L variables
  for (unsigned int l = 0; l < _num_L; ++l)
  {
    // Create L base name
    std::string L_name = _L_name_base;
    std::stringstream out;
    out << l;
    L_name.append(out.str());

    // Create real L variable
    std::string real_name = L_name;
    real_name.append("_real");


#ifdef DEBUG
    Moose::err << "Real name = " << real_name << std::endl;
#endif

    _problem->addAuxVariable(real_name,
                             FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
                                    Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family"))));

    poly_params = _factory.getValidParams("MultiAppNearestNodeTransfer");
    poly_params.set<MooseEnum>("direction") = "from_multiapp";
    poly_params.set<AuxVariableName>("variable") = real_name;
    poly_params.set<VariableName>("source_variable") = real_name;
    poly_params.set<MultiAppName>("multi_app") = "HHEquationSolver";


    // Create Name for Transfer
    std::string trans_name = real_name;
    trans_name.append("_trans");

    _problem->addTransfer("MultiAppNearestNodeTransfer", trans_name, poly_params);

    if (l > 0)
    {
      // Create imaginary L variable IF l > 0
      std::string imag_name = L_name;
      imag_name.append("_imag");

#ifdef DEBUG
      Moose::err << "Imaginary name = " << imag_name << std::endl;
#endif

      _problem->addAuxVariable(imag_name,
                               FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
                                      Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family"))));

      poly_params = _factory.getValidParams("MultiAppNearestNodeTransfer");
      poly_params.set<MooseEnum>("direction") = "from_multiapp";
      poly_params.set<AuxVariableName>("variable") = imag_name;
      poly_params.set<VariableName>("source_variable") = imag_name;
      poly_params.set<MultiAppName>("multi_app") = "HHEquationSolver";

      // Create Name for Transfer
      std::string trans_name = imag_name;
      trans_name.append("_trans");

      _problem->addTransfer("MultiAppNearestNodeTransfer", trans_name, poly_params);
    }

  }

}