https://mooseframework.inl.gov
MaterialVectorBodyForceAction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "Factory.h"
12 #include "FEProblem.h"
13 #include "Conversion.h"
14 
15 registerMooseAction("SolidMechanicsApp", MaterialVectorBodyForceAction, "add_kernel");
16 
19 {
21  params.addClassDescription("Set up volumetric body force kernels");
22 
23  params.addParam<std::vector<SubdomainName>>("block",
24  "The block ids where the body force will be applied");
25 
26  params.addParam<std::vector<VariableName>>(
27  "displacements",
28  {},
29  "The displacements appropriate for the simulation geometry and coordinate system");
30 
31  params.addParam<FunctionName>(
32  "function", "1", "Function to scale the coupled body force vector property");
33  params.addParam<Real>(
34  "hht_alpha", 0.0, "alpha parameter required for HHT time integration scheme");
35  params.addRequiredParam<MaterialPropertyName>("body_force", "Force per unit volume vector");
36  return params;
37 }
38 
40  : Action(params)
41 {
42 }
43 
44 void
46 {
47  std::string kernel_type = "MaterialVectorBodyForce";
48 
49  auto displacements = getParam<std::vector<VariableName>>("displacements");
50  for (const auto & disp : displacements)
51  {
52  InputParameters params = _factory.getValidParams(kernel_type);
53  params.applyParameters(parameters());
54  params.set<NonlinearVariableName>("variable") = disp;
55  _problem->addKernel(kernel_type, _name + "_" + disp, params);
56  }
57 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
void applyParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
void addRequiredParam(const std::string &name, const std::string &doc_string)
Factory & _factory
static InputParameters validParams()
const std::string _name
registerMooseAction("SolidMechanicsApp", MaterialVectorBodyForceAction, "add_kernel")
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MaterialVectorBodyForceAction(const InputParameters &params)
void addClassDescription(const std::string &doc_string)
std::shared_ptr< FEProblemBase > & _problem
const InputParameters & parameters() const