https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
15registerMooseAction("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
43
44void
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);
54 params.set<NonlinearVariableName>("variable") = disp;
55 _problem->addKernel(kernel_type, _name + "_" + disp, params);
56 }
57}
registerMooseAction("SolidMechanicsApp", MaterialVectorBodyForceAction, "add_kernel")
static InputParameters validParams()
std::shared_ptr< FEProblemBase > & _problem
InputParameters getValidParams(const std::string &name) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void applyParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
MaterialVectorBodyForceAction(const InputParameters &params)
const InputParameters & parameters() const
const std::string & _name
Factory & _factory