Line data Source code
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 : 10 : #include "ComputeHomogenizedLagrangianStrain.h" 11 : 12 : registerMooseObject("SolidMechanicsApp", ComputeHomogenizedLagrangianStrain); 13 : 14 : InputParameters 15 592 : ComputeHomogenizedLagrangianStrain::validParams() 16 : { 17 592 : InputParameters params = Material::validParams(); 18 592 : params.addClassDescription("Calculate eigenstrain-like contribution from the homogenization " 19 : "strain used to satisfy the homogenization constraints."); 20 1184 : params.addParam<std::string>("base_name", "Material property base name"); 21 1184 : params.addRequiredParam<UserObjectName>( 22 : "homogenization_constraint", "The UserObject for defining the homogenization constraint"); 23 1184 : params.addParam<MaterialPropertyName>("homogenization_gradient_name", 24 : "homogenization_gradient", 25 : "Name of the constant gradient field"); 26 1184 : params.addRequiredCoupledVar("macro_gradient", 27 : "Scalar field defining the " 28 : "macro gradient"); 29 592 : return params; 30 0 : } 31 : 32 444 : ComputeHomogenizedLagrangianStrain::ComputeHomogenizedLagrangianStrain( 33 444 : const InputParameters & parameters) 34 : : Material(parameters), 35 444 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""), 36 444 : _constraint(getUserObject<HomogenizationConstraint>("homogenization_constraint")), 37 444 : _cmap(_constraint.getConstraintMap()), 38 444 : _macro_gradient(coupledScalarValue("macro_gradient")), 39 444 : _homogenization_contribution( 40 888 : declareProperty<RankTwoTensor>(_base_name + "homogenization_gradient_name")) 41 : { 42 444 : } 43 : 44 : void 45 36748144 : ComputeHomogenizedLagrangianStrain::computeQpProperties() 46 : { 47 36748144 : _homogenization_contribution[_qp].zero(); 48 : unsigned int count = 0; 49 302535392 : for (auto && indices : _cmap) 50 : { 51 : auto && [i, j] = indices.first; 52 265787248 : _homogenization_contribution[_qp](i, j) = _macro_gradient[count++]; 53 : } 54 36748144 : }