29 params.
addClassDescription(
"Calculate element contribution to the homogenization constraint " 30 "depending on the homogenization constraint type.");
34 "Type of each constraint: strain, stress, or none. The types are specified in the " 35 "column-major order, and there must be 9 entries in total.");
37 "targets",
"Functions giving the targets to hit for constraint types that are not none.");
38 params.
addParam<
bool>(
"large_kinematics",
false,
"Using large displacements?");
39 params.
addParam<std::string>(
"base_name",
"Material property base name");
45 _large_kinematics(getParam<bool>(
"large_kinematics")),
46 _base_name(isParamValid(
"base_name") ? getParam<
std::string>(
"base_name") +
"_" :
""),
47 _F(getMaterialPropertyByName<
RankTwoTensor>(_base_name +
"deformation_gradient")),
48 _pk1_stress(getMaterialPropertyByName<
RankTwoTensor>(_base_name +
"pk1_stress")),
49 _pk1_jacobian(getMaterialPropertyByName<
RankFourTensor>(_base_name +
"pk1_jacobian"))
52 auto types = getParam<MultiMooseEnum>(
"constraint_types");
54 mooseError(
"Number of constraint types must equal dim * dim. ", types.size(),
" are provided.");
57 const std::vector<FunctionName> & fnames = getParam<std::vector<FunctionName>>(
"targets");
60 unsigned int fcount = 0;
109 std::copy(residual.begin(), residual.end(), &
_residual(0, 0));
110 std::copy(jacobian.begin(), jacobian.end(), &
_jacobian(0, 0, 0, 0));
118 for (
auto && [indices, constraint] :
_cmap)
120 auto && [i,
j] = indices;
121 auto && [ctype, ctarget] = constraint;
130 mooseError(
"Unknown constraint type in the integral!");
140 mooseError(
"Unknown constraint type in the integral!");
152 for (
auto && [indices1, constraint1] :
_cmap)
154 auto && [i,
j] = indices1;
155 auto && ctype = constraint1.first;
156 for (
auto && indices2 :
_cmap)
158 auto && [
a,
b] = indices2.first;
169 mooseError(
"Unknown constraint type in Jacobian calculator!");
virtual RankTwoTensor computeResidual()
Total residual assembled as a rank two tensor.
virtual void initialize() override
const MooseArray< Point > & _q_point
const MooseArray< Real > & _coord
RankTwoTensor _residual
The assembled tensor residual.
static InputParameters validParams()
virtual void threadJoin(const UserObject &y) override
static constexpr std::size_t dim
const std::vector< double > y
const MaterialProperty< RankTwoTensor > & _F
Deformation gradient.
RankFourTensor _jacobian
The assembled tensor jacobian.
static constexpr unsigned int N4
Computes ${V}(X_{ij}-{X}_{ij})dV$.
static constexpr unsigned int N2
static InputParameters validParams()
Real f(Real x)
Test function for Brents method.
unsigned int _qp
Used to loop through quadrature points.
virtual void finalize() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const QBase *const & _qrule
ConstraintType
Constraint type: stress/PK stress or strain/deformation gradient.
const Function & getFunctionByName(const FunctionName &name) const
const MooseArray< Real > & _JxW
virtual void execute() override
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const MultiMooseEnum constraintType("strain stress none")
Moose constraint type, for input.
Homogenization::ConstraintMap _cmap
Type of each constraint (stress or strain) for each component.
virtual RankFourTensor computeJacobian()
Total Jacobian assembled as a rank two tensor.
const MaterialProperty< RankFourTensor > & _pk1_jacobian
PK derivative.
const MaterialProperty< RankTwoTensor > & _pk1_stress
1st PK (or small) stress
const bool _large_kinematics
If true use large displacement kinematics.
registerMooseObject("SolidMechanicsApp", HomogenizationConstraint)
HomogenizationConstraint(const InputParameters ¶meters)