www.mooseframework.org
AddMaterialAction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
10 #include "AddMaterialAction.h"
11 #include "FEProblem.h"
12 
13 registerMooseAction("MooseApp", AddMaterialAction, "add_material");
14 
16 
19 {
21 }
22 
24 
25 void
27 {
28  if (Registry::isADObj(_type + "<RESIDUAL>"))
29  {
30  if (!_moose_object_pars.get<bool>("_interface"))
31  {
32  _problem->addADResidualMaterial(
33  _type + "<RESIDUAL>", _name + "_residual", _moose_object_pars);
34  _problem->addADJacobianMaterial(
35  _type + "<JACOBIAN>", _name + "_jacobian", _moose_object_pars);
36  }
37  else
38  {
39  _problem->addADResidualInterfaceMaterial(
40  _type + "<RESIDUAL>", _name + "_residual", _moose_object_pars);
41  _problem->addADJacobianInterfaceMaterial(
42  _type + "<JACOBIAN>", _name + "_jacobian", _moose_object_pars);
43  }
44  _problem->haveADObjects(true);
45  }
46  else
47  {
48  if (!_moose_object_pars.get<bool>("_interface"))
49  _problem->addMaterial(_type, _name, _moose_object_pars);
50  else
51  _problem->addInterfaceMaterial(_type, _name, _moose_object_pars);
52  }
53 }
AddMaterialAction::AddMaterialAction
AddMaterialAction(InputParameters params)
Definition: AddMaterialAction.C:23
AddMaterialAction.h
AddMaterialAction::validParams
static InputParameters validParams()
Definition: AddMaterialAction.C:18
FEProblem.h
registerMooseAction
registerMooseAction("MooseApp", AddMaterialAction, "add_material")
defineLegacyParams
defineLegacyParams(AddMaterialAction)
Registry::isADObj
static bool isADObj(const std::string &name)
Definition: Registry.C:111
Action::_problem
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:246
AddMaterialAction
Definition: AddMaterialAction.h:19
MooseObjectAction::validParams
static InputParameters validParams()
Definition: MooseObjectAction.C:21
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
MooseObjectAction::_type
std::string _type
The Object type that is being created.
Definition: MooseObjectAction.h:48
MooseObjectAction::_moose_object_pars
InputParameters _moose_object_pars
The parameters for the object to be created.
Definition: MooseObjectAction.h:51
Action::_name
std::string _name
The name of the action.
Definition: Action.h:207
AddMaterialAction::act
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.
Definition: AddMaterialAction.C:26
MooseObjectAction
Definition: MooseObjectAction.h:21