forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProjectedStatefulMaterialStorageAction.C
85 lines (72 loc) · 2.73 KB
/
ProjectedStatefulMaterialStorageAction.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
// MOOSE includes
#include "ProjectedStatefulMaterialStorageAction.h"
#include "RankFourTensorForward.h"
#include "RankTwoTensorForward.h"
#include "AddAuxVariableAction.h"
#include "AddVariableAction.h"
#include "FEProblemBase.h"
#include "Factory.h"
#include "libmesh/string_to_enum.h"
// we need to add these variables after the material property types are known
registerMooseAction("MooseApp",
ProjectedStatefulMaterialStorageAction,
"setup_projected_properties");
registerMooseAction("MooseApp", ProjectedStatefulMaterialStorageAction, "add_aux_kernel");
InputParameters
ProjectedStatefulMaterialStorageAction::validParams()
{
InputParameters params = Action::validParams();
params.addClassDescription("Mark material properties for projected stateful storage.");
params.addParam<MooseEnum>(
"family",
MooseEnum("LAGRANGE MONOMIAL L2_LAGRANGE L2_HIERARCHIC", "LAGRANGE"),
"Finite element variable family to project the material properties onto");
params.addParam<MooseEnum>(
"order",
AddAuxVariableAction::getAuxVariableOrders(),
"Finite element variable order to project the material properties onto");
// block restrictions
params += BlockRestrictable::validParams();
params.addParam<std::vector<MaterialPropertyName>>(
"projected_props", {}, "Material properties to project for stateful storage");
return params;
}
ProjectedStatefulMaterialStorageAction::ProjectedStatefulMaterialStorageAction(
const InputParameters & params)
: Action(params),
_prop_names(getParam<std::vector<MaterialPropertyName>>("projected_props")),
_order(params.get<MooseEnum>("order")),
_fe_type({Utility::string_to_enum<Order>(_order),
Utility::string_to_enum<FEFamily>(params.get<MooseEnum>("family"))}),
_var_type(AddVariableAction::variableType(_fe_type))
{
}
void
ProjectedStatefulMaterialStorageAction::addRelationshipManagers(
Moose::RelationshipManagerType input_rm_type)
{
auto params = ProjectedStatefulMaterialNodalPatchRecoveryBase::validParams();
addRelationshipManagers(input_rm_type, params);
}
void
ProjectedStatefulMaterialStorageAction::act()
{
for (const auto & prop_name : _prop_names)
{
// loop over all supported property types
Moose::typeLoop<ProcessProperty>(SupportedTypes{}, this, prop_name);
}
}
MooseEnum
ProjectedStatefulMaterialStorageAction::getTypeEnum()
{
return getTypeEnum(SupportedTypes{});
}