https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
MechanicsActionPD Class Reference

Action class to setup peridynamic models for solid mechanics problems. More...

#include <MechanicsActionPD.h>

Inheritance diagram for MechanicsActionPD:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 MechanicsActionPD (const InputParameters &params)
 
virtual void act () override
 
void timedAct ()
 
virtual void addRelationshipManagers (Moose::RelationshipManagerType when_type)
 
MooseObjectName uniqueActionName () const
 
const std::string & specificTaskName () const
 
const std::set< std::string > & getAllTasks () const
 
void appendTask (const std::string &task)
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
PerfGraphperfGraph ()
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 

Public Attributes

const ConsoleStream _console
 

Static Public Attributes

static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Member Functions

virtual std::string getKernelName ()
 Function to get the kernel name based on the value of member variables: _formulation and _stabilization. More...
 
virtual InputParameters getKernelParameters (std::string name)
 Function to get the input parameters for a given kernel name. More...
 
bool addRelationshipManagers (Moose::RelationshipManagerType when_type, const InputParameters &moose_object_pars)
 
void associateWithParameter (const std::string &param_name, InputParameters &params) const
 
void associateWithParameter (const InputParameters &from_params, const std::string &param_name, InputParameters &params) const
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

const MooseEnum _formulation
 Option of which peridynamic model needs to be setup: BOND, ORDINARY_STATE or NONORDINARY_STATE. More...
 
const MooseEnum _stabilization
 Option of stabilization scheme for correspondence material model: FORCE, BOND_HORIZON_I or BOND_HORIZON_II. More...
 
const MooseEnum _strain
 Option of strain formulation: SMALL or FINITE. More...
 
std::vector< SubdomainName > _subdomain_names
 vector of subdomain names from provided blocks More...
 
std::set< SubdomainID_subdomain_ids
 set of subdomain IDs generated from the passed in vector of subdomain names More...
 
std::set< SubdomainID_subdomain_id_union
 set of SubdomainID generated from the combined block restrictions of all TensorMechanics/Master action blocks More...
 
std::string _registered_identifier
 
std::string _specific_task_name
 
std::set< std::string > _all_tasks
 
ActionWarehouse_awh
 
const std::string & _current_task
 
std::shared_ptr< MooseMesh > & _mesh
 
std::shared_ptr< MooseMesh > & _displaced_mesh
 
std::shared_ptr< FEProblemBase > & _problem
 
PerfID _act_timer
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
const Parallel::Communicator & _communicator
 
std::vector< VariableName > _displacements
 Displacement variables. More...
 
const unsigned int _ndisp
 
std::vector< AuxVariableName > _save_in
 Residual debugging. More...
 
std::vector< AuxVariableName > _diag_save_in
 

Detailed Description

Action class to setup peridynamic models for solid mechanics problems.

Definition at line 17 of file MechanicsActionPD.h.

Constructor & Destructor Documentation

◆ MechanicsActionPD()

MechanicsActionPD::MechanicsActionPD ( const InputParameters params)

Definition at line 65 of file MechanicsActionPD.C.

66  : Action(params),
67  _displacements(getParam<std::vector<VariableName>>("displacements")),
68  _ndisp(_displacements.size()),
69  _formulation(getParam<MooseEnum>("formulation")),
70  _stabilization(getParam<MooseEnum>("stabilization")),
71  _strain(getParam<MooseEnum>("strain")),
72  _subdomain_names(getParam<std::vector<SubdomainName>>("block")),
74  _save_in(getParam<std::vector<AuxVariableName>>("save_in")),
75  _diag_save_in(getParam<std::vector<AuxVariableName>>("diag_save_in"))
76 {
77  // Consistency check
78  if (_formulation == "NONORDINARY_STATE" && !isParamValid("stabilization"))
79  mooseError("'stabilization' is a required parameter for non-ordinary state-based models only.");
80 
81  if (_save_in.size() != 0 && _save_in.size() != _ndisp)
82  mooseError("Number of save_in variables should equal to the number of displacement variables ",
83  _ndisp);
84 
85  if (_diag_save_in.size() != 0 && _diag_save_in.size() != _ndisp)
86  mooseError(
87  "Number of diag_save_in variables should equal to the number of displacement variables ",
88  _ndisp);
89 }
std::vector< AuxVariableName > _save_in
Residual debugging.
std::vector< AuxVariableName > _diag_save_in
Action(const InputParameters &parameters)
const unsigned int _ndisp
const MooseEnum _strain
Option of strain formulation: SMALL or FINITE.
bool isParamValid(const std::string &name) const
const MooseEnum _formulation
Option of which peridynamic model needs to be setup: BOND, ORDINARY_STATE or NONORDINARY_STATE.
const T & getParam(const std::string &name) const
std::set< SubdomainID > _subdomain_ids
set of subdomain IDs generated from the passed in vector of subdomain names
std::vector< VariableName > _displacements
Displacement variables.
const MooseEnum _stabilization
Option of stabilization scheme for correspondence material model: FORCE, BOND_HORIZON_I or BOND_HORIZ...
void mooseError(Args &&... args) const
std::vector< SubdomainName > _subdomain_names
vector of subdomain names from provided blocks

Member Function Documentation

◆ act()

void MechanicsActionPD::act ( )
overridevirtual

Implements Action.

Definition at line 92 of file MechanicsActionPD.C.

93 {
94  if (_current_task == "setup_mesh_complete")
95  {
96  // get subdomain IDs
97  for (auto & name : _subdomain_names)
98  _subdomain_ids.insert(_mesh->getSubdomainID(name));
99  }
100  else if (_current_task == "create_problem_complete")
101  {
102  // Gather info about all other master actions for adding (aux)variables
103  auto actions = _awh.getActions<MechanicsActionPD>();
104  for (const auto & action : actions)
105  {
106  const auto size_before = _subdomain_id_union.size();
107  const auto added_size = action->_subdomain_ids.size();
108  _subdomain_id_union.insert(action->_subdomain_ids.begin(), action->_subdomain_ids.end());
109  const auto size_after = _subdomain_id_union.size();
110 
111  if (size_after != size_before + added_size)
112  mooseError("The block restrictions in the Peridynamics/Mechanics/Master actions must be "
113  "non-overlapping!");
114 
115  if (added_size == 0 && actions.size() > 1)
116  mooseError(
117  "No Peridynamics/Mechanics/Master action can be block unrestricted if more than one "
118  "Peridynamics/Mechanics/Master action is specified!");
119  }
120  }
121  else if (_current_task == "add_aux_variable")
122  {
123  // add the bond_status aux variable to all peridynamic domains
124  const std::string var_type = "MooseVariableConstMonomial";
125  InputParameters params = _factory.getValidParams(var_type);
126  params.set<MooseEnum>("order") = "CONSTANT";
127  params.set<MooseEnum>("family") = "MONOMIAL";
128 
129  if (!_subdomain_id_union.empty())
130  for (const SubdomainID & id : _subdomain_id_union)
131  params.set<std::vector<SubdomainName>>("block").push_back(Moose::stringify(id));
132 
133  _problem->addAuxVariable(var_type, "bond_status", params);
134  }
135  else if (_current_task == "add_ic")
136  {
137  const std::string ic_type = "ConstantIC";
138  const std::string ic_name = name() + "bond_status";
139 
140  InputParameters params = _factory.getValidParams(ic_type);
141  params.set<VariableName>("variable") = "bond_status";
142  params.set<Real>("value") = 1.0;
143 
144  // check whether this object is restricted to certain block?
145  if (isParamValid("block"))
146  params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
147 
148  _problem->addInitialCondition(ic_type, ic_name, params);
149  }
150  else if (_current_task == "add_user_object")
151  {
152  // add ghosting UO
153  const std::string uo_type = "GhostElemPD";
154  const std::string uo_name = name() + "GhostElemPD";
155 
156  InputParameters params = _factory.getValidParams(uo_type);
157  params.set<bool>("use_displaced_mesh") = (_strain == "FINITE");
158 
159  _problem->addUserObject(uo_type, uo_name, params);
160  }
161  else if (_current_task == "add_kernel")
162  {
163  const std::string kernel_name = getKernelName();
164  InputParameters params = getKernelParameters(kernel_name);
165 
166  for (unsigned int i = 0; i < _ndisp; ++i)
167  {
168  const std::string kernel_object_name = name() + "Peridynamics_" + Moose::stringify(i);
169 
170  params.set<unsigned int>("component") = i;
171  params.set<NonlinearVariableName>("variable") = _displacements[i];
172 
173  if (_save_in.size() != 0)
174  params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]};
175  if (_diag_save_in.size() != 0)
176  params.set<std::vector<AuxVariableName>>("diag_save_in") = {_diag_save_in[i]};
177 
178  _problem->addKernel(kernel_name, kernel_object_name, params);
179  }
180  }
181  else
182  mooseError("Task error in MechanicsActionPD!");
183 }
std::vector< AuxVariableName > _save_in
Residual debugging.
std::vector< AuxVariableName > _diag_save_in
std::set< SubdomainID > _subdomain_id_union
set of SubdomainID generated from the combined block restrictions of all TensorMechanics/Master actio...
ActionWarehouse & _awh
const unsigned int _ndisp
T & set(const std::string &name, bool quiet_mode=false)
Action class to setup peridynamic models for solid mechanics problems.
InputParameters getValidParams(const std::string &name) const
virtual InputParameters getKernelParameters(std::string name)
Function to get the input parameters for a given kernel name.
virtual std::string getKernelName()
Function to get the kernel name based on the value of member variables: _formulation and _stabilizati...
virtual const std::string & name() const
const MooseEnum _strain
Option of strain formulation: SMALL or FINITE.
bool isParamValid(const std::string &name) const
Factory & _factory
const std::string & _current_task
std::set< SubdomainID > _subdomain_ids
set of subdomain IDs generated from the passed in vector of subdomain names
std::string stringify(const T &t)
std::shared_ptr< MooseMesh > & _mesh
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< VariableName > _displacements
Displacement variables.
void mooseError(Args &&... args) const
std::shared_ptr< FEProblemBase > & _problem
std::vector< SubdomainName > _subdomain_names
vector of subdomain names from provided blocks
std::vector< const T *> getActions()

◆ getKernelName()

std::string MechanicsActionPD::getKernelName ( )
protectedvirtual

Function to get the kernel name based on the value of member variables: _formulation and _stabilization.

Returns
Kernel name

Definition at line 186 of file MechanicsActionPD.C.

Referenced by act().

187 {
188  std::string name;
189 
190  if (_formulation == "BOND")
191  {
192  name = "MechanicsBPD";
193  }
194  else if (_formulation == "ORDINARY_STATE")
195  {
196  name = "MechanicsOSPD";
197  }
198  else if (_formulation == "NONORDINARY_STATE")
199  {
200  if (_stabilization == "FORCE")
201  {
202  name = "ForceStabilizedSmallStrainMechanicsNOSPD";
203  }
204  else if (_stabilization == "BOND_HORIZON_I")
205  {
206  if (_strain == "SMALL")
207  name = "HorizonStabilizedFormISmallStrainMechanicsNOSPD";
208  else
209  name = "HorizonStabilizedFormIFiniteStrainMechanicsNOSPD";
210  }
211  else if (_stabilization == "BOND_HORIZON_II")
212  {
213  if (_strain == "SMALL")
214  name = "HorizonStabilizedFormIISmallStrainMechanicsNOSPD";
215  else
216  name = "HorizonStabilizedFormIIFiniteStrainMechanicsNOSPD";
217  }
218  else
219  paramError("stabilization", "Unknown PD stabilization scheme!");
220  }
221  else
222  paramError("formulation", "Unsupported peridynamic formulation!");
223 
224  return name;
225 }
virtual const std::string & name() const
const MooseEnum _strain
Option of strain formulation: SMALL or FINITE.
const MooseEnum _formulation
Option of which peridynamic model needs to be setup: BOND, ORDINARY_STATE or NONORDINARY_STATE.
void paramError(const std::string &param, Args... args) const
const MooseEnum _stabilization
Option of stabilization scheme for correspondence material model: FORCE, BOND_HORIZON_I or BOND_HORIZ...

◆ getKernelParameters()

InputParameters MechanicsActionPD::getKernelParameters ( std::string  name)
protectedvirtual

Function to get the input parameters for a given kernel name.

Parameters
namethe name of the kernel
Returns
Parameters for the corresponding kernel

Definition at line 228 of file MechanicsActionPD.C.

Referenced by act().

229 {
231 
232  params.applyParameters(parameters(),
233  {"displacements",
234  "temperature",
235  "out_of_plane_strain",
236  "eigenstrain_names",
237  "use_displaced_mesh",
238  "save_in",
239  "diag_save_in"});
240 
241  params.set<std::vector<VariableName>>("displacements") = _displacements;
242  if (isParamValid("temperature"))
243  params.set<std::vector<VariableName>>("temperature") = {getParam<VariableName>("temperature")};
244  if (isParamValid("out_of_plane_strain"))
245  params.set<std::vector<VariableName>>("out_of_plane_strain") = {
246  getParam<VariableName>("out_of_plane_strain")};
247 
248  // peridynamics modules are formulated based on initial configuration
249  params.set<bool>("use_displaced_mesh") = false;
250 
251  if (_formulation == "NONORDINARY_STATE" && isParamValid("eigenstrain_names"))
252  {
253  params.set<std::vector<MaterialPropertyName>>("eigenstrain_names") =
254  getParam<std::vector<MaterialPropertyName>>("eigenstrain_names");
255  }
256 
257  return params;
258 }
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)
virtual const std::string & name() const
bool isParamValid(const std::string &name) const
Factory & _factory
const T & getParam(const std::string &name) const
const MooseEnum _formulation
Option of which peridynamic model needs to be setup: BOND, ORDINARY_STATE or NONORDINARY_STATE.
std::vector< VariableName > _displacements
Displacement variables.
const InputParameters & parameters() const

◆ validParams()

InputParameters MechanicsActionPD::validParams ( )
static

Definition at line 26 of file MechanicsActionPD.C.

27 {
29  params.addClassDescription("Class for setting up peridynamic kernels");
30 
31  params.addRequiredParam<std::vector<VariableName>>(
32  "displacements", "Nonlinear variable names for the displacements");
33  MooseEnum formulation_option("BOND ORDINARY_STATE NONORDINARY_STATE");
35  "formulation", formulation_option, "Peridynamic formulation options");
36  MooseEnum stabilization_option("FORCE BOND_HORIZON_I BOND_HORIZON_II");
37  params.addParam<MooseEnum>("stabilization",
38  stabilization_option,
39  "Stabilization techniques for the peridynamic correspondence model");
40  params.addParam<bool>(
41  "full_jacobian",
42  false,
43  "Parameter to set whether to use full jacobian for state based formulation or not");
44  MooseEnum strain_type("SMALL FINITE", "SMALL");
45  params.addParam<MooseEnum>("strain", strain_type, "Strain formulation");
46  params.addParam<VariableName>("temperature", "Nonlinear variable name for the temperature");
47  params.addParam<VariableName>("out_of_plane_strain",
48  "Nonlinear variable name for the out_of_plane strain for "
49  "plane stress using the NOSPD formulation");
50  params.addParam<std::vector<SubdomainName>>("block",
51  {},
52  "List of ids of the blocks (subdomains) that the "
53  "peridynamic mechanics kernel will be applied to");
54  params.addParam<std::vector<AuxVariableName>>("save_in", {}, "The displacement residuals");
55  params.addParam<std::vector<AuxVariableName>>(
56  "diag_save_in", {}, "The displacement diagonal preconditioner terms");
57  params.addParam<std::vector<MaterialPropertyName>>(
58  "eigenstrain_names",
59  {},
60  "List of eigenstrains to be coupled in non-ordinary state-based mechanics kernels");
61 
62  return params;
63 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _diag_save_in

std::vector<AuxVariableName> MechanicsActionPD::_diag_save_in
protected

Definition at line 69 of file MechanicsActionPD.h.

Referenced by act(), and MechanicsActionPD().

◆ _displacements

std::vector<VariableName> MechanicsActionPD::_displacements
protected

Displacement variables.

Definition at line 42 of file MechanicsActionPD.h.

Referenced by act(), and getKernelParameters().

◆ _formulation

const MooseEnum MechanicsActionPD::_formulation
protected

Option of which peridynamic model needs to be setup: BOND, ORDINARY_STATE or NONORDINARY_STATE.

Definition at line 48 of file MechanicsActionPD.h.

Referenced by getKernelName(), getKernelParameters(), and MechanicsActionPD().

◆ _ndisp

const unsigned int MechanicsActionPD::_ndisp
protected

Definition at line 43 of file MechanicsActionPD.h.

Referenced by act(), and MechanicsActionPD().

◆ _save_in

std::vector<AuxVariableName> MechanicsActionPD::_save_in
protected

Residual debugging.

Definition at line 68 of file MechanicsActionPD.h.

Referenced by act(), and MechanicsActionPD().

◆ _stabilization

const MooseEnum MechanicsActionPD::_stabilization
protected

Option of stabilization scheme for correspondence material model: FORCE, BOND_HORIZON_I or BOND_HORIZON_II.

Definition at line 52 of file MechanicsActionPD.h.

Referenced by getKernelName().

◆ _strain

const MooseEnum MechanicsActionPD::_strain
protected

Option of strain formulation: SMALL or FINITE.

Definition at line 55 of file MechanicsActionPD.h.

Referenced by act(), and getKernelName().

◆ _subdomain_id_union

std::set<SubdomainID> MechanicsActionPD::_subdomain_id_union
protected

set of SubdomainID generated from the combined block restrictions of all TensorMechanics/Master action blocks

Definition at line 65 of file MechanicsActionPD.h.

Referenced by act().

◆ _subdomain_ids

std::set<SubdomainID> MechanicsActionPD::_subdomain_ids
protected

set of subdomain IDs generated from the passed in vector of subdomain names

Definition at line 61 of file MechanicsActionPD.h.

Referenced by act().

◆ _subdomain_names

std::vector<SubdomainName> MechanicsActionPD::_subdomain_names
protected

vector of subdomain names from provided blocks

Definition at line 58 of file MechanicsActionPD.h.

Referenced by act().


The documentation for this class was generated from the following files: